Logging to the console

About this task

If you want logging output to the standard output stream, rather than to a logging file, specify the use of the STDOUT appender:


log4j.rootCategory=info, STDOUT

Depending on the configuration of the servlet container, the logging output will be directed to the standard destination of the System.out output stream. Note that when you specify a different appender, you must include the appender’s properties in the custom log4j.properties file too. For example:


log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=[%t] (%c{2}) - %m%n

Note that you can also force logging to be output to the System.out output stream by specifying -Dcomergent.console.logging=true as part of the command line that starts the servlet container. This overrides any logging properties specified in the log4j.properties configuration file.