11.3.5. Configure a Periodic Log Handler in the CLI
- Display the configuration of a periodic log handler
- Add a new periodic log handler.
- Set the handler's log level.
- Set the handler's appending behaviour.
- Set whether the handler uses autoflush or not.
- Set the encoding used for the handler's output.
- Specify the file to which the log handler will write.
- Set the formatter used for the handler's output.
- Set the suffix for rotated logs
- Remove a periodic log handler.
- Display a Periodic Rotating File log handler configuration
- Use the
read-resourceoperation with the following syntax./subsystem=logging/periodic-rotating-file-handler=HANDLER:read-resource
Replace HANDLER with the name of the file log handler.Example 11.29. Using the read-resource operation
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:read-resource { "outcome" => "success", "result" => { "append" => true, "autoflush" => true, "encoding" => undefined, "file" => { "path" => "daily-debug.log", "relative-to" => "jboss.server.log.dir" }, "filter" => undefined, "formatter" => "%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n", "level" => undefined } } [standalone@localhost:9999 /] - Add a new Periodic Rotating File log handler
- Use the
addoperation with the following syntax./subsystem=logging/periodic-rotating-file-handler=HANDLER:add(file={"path"=>"PATH", "relative-to"=>"DIR"}, suffix="SUFFIX")Replace HANDLER with the name of the log handler. Replace PATH with the filename for the file that the log is being written to. Replace DIR with the name of the directory where the file is to be located. The value of DIR can be a path variable. Replace SUFFIX with the file rotation suffix to be used.Example 11.30. Add a new handler
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:add(file={"path"=>"daily-debug.log", "relative-to"=>"jboss.server.log.dir"}, suffix=".yyyy.MM.dd") {"outcome" => "success"} [standalone@localhost:9999 /] - Set the Log level
- Use the
change-log-leveloperation with the following syntax./subsystem=logging/periodic-rotating-file-handler=HANDLER:change-log-level(level="LEVEL")
Replace HANDLER with the name of the periodic log handler. Replace LEVEL with the log level that is to be set.Example 11.31. Set the log level
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:change-log-level(level="DEBUG") {"outcome" => "success"} [standalone@localhost:9999 /] - Set the append behaviour
- Use the
write-attributeoperation with the following syntax./subsystem=logging/periodic-rotating-handler=HANDLER:write-attribute(name="append", value="BOOLEAN")
Replace HANDLER with the name of the periodic log handler. Replace BOOLEAN withfalseif you required that a new log file be created each time the application server is launched. Replace BOOLEAN withtrueif the application server should continue to use the same file.JBoss Enterprise Application Platform 6 must be restarted for this change to take effect.Example 11.32. Set the append behaviour
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="append", value="true") { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } } [standalone@localhost:9999 /] - Set the Auto Flush
- Use the
write-attributeoperation with the following syntax./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="autoflush", value="BOOLEAN")
Replace HANDLER with the name of the periodic log handler. Replace BOOLEAN withtrueif this handler is to immediately write its output.JBoss Enterprise Application Platform 6 must be restarted for this change to take effect.Example 11.33. Set the Auto Flush behaviour
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="autoflush", value="false") { "outcome" => "success", "response-headers" => {"process-state" => "reload-required"} } [standalone@localhost:9999 /] - Set the Encoding
- Use the
write-attributeoperation with the following syntax./subsystem=logging/periodic-rotating-file-handler=HANDLER:write-attribute(name="encoding", value="ENCODING")
Replace HANDLER with the name of the periodic log handler. Replace ENCODING with the name of the required character encoding system.Example 11.34. Set the Encoding
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:write-attribute(name="encoding", value="utf-8") {"outcome" => "success"} [standalone@localhost:9999 /] - Change the file to which the log handler writes
- Use the
change-fileoperation with the following syntax./subsystem=logging/periodic-rotating-file-handle=HANDLER:change-file(file={"path"=>"PATH", "relative-to"=>"DIR"})Replace HANDLER with the name of the periodic log handler. Replace PATH with the filename for the file that the log is being written to. Replace DIR with the name of the directory where the file is to be located. The value of DIR can be a path variable.Example 11.35. Change the file to which the log handler writes
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handle=HOURLY_DEBUG:change-file(file={"path"=>"daily-debug.log", "relative-to"=>"jboss.server.log.dir"}) {"outcome" => "success"} [standalone@localhost:9999 /] - Set the Formatter
- Use the
write-attributeoperation with the following syntax./subsystem=logging/periodic-rotating-file-handle=HANDLER:write-attribute(name="formatter", value="FORMAT")
Replace HANDLER with the name of the periodic log handler. Replace FORMAT with the required formatter string.Example 11.36. Set the Formatter
[standalone@l/subsystem=logging/periodic-rotating-file-handle=HOURLY_DEBUG:write-attribute(name="formatter", value="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n")) {"outcome" => "success"} [standalone@localhost:9999 /] - Set the suffix for rotated logs
- Use the
write-attributeoperation with the following syntax./subsystem=logging/periodic-rotating-file-handle=HANDLER:write-attribute(name="suffix", value="SUFFIX")
Replace HANDLER with the name of the console log handler. Replace SUFFIX with the required suffix string.Example 11.37.
[standalone@l/subsystem=logging/periodic-rotating-file-handle=HOURLY_DEBUG:write-attribute(name="suffix", value=".yyyy-MM-dd-HH")) {"outcome" => "success"} [standalone@localhost:9999 /] - Remove a periodic log handler
- Use the
removeoperation with the following syntax./subsystem=logging/periodic-rotating-file-handler=HANDLER:remove
Replace HANDLER with the name of the periodic log handler.Example 11.38. Remove a periodic log handler
[standalone@localhost:9999 /] /subsystem=logging/periodic-rotating-file-handler=HOURLY_DEBUG:remove {"outcome" => "success"} [standalone@localhost:9999 /]

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.