I tested the log4j2 but something went wrong with the log4j2-jcl. Maybe a
configuration issue.
commonslogger.debug("Test commons.logging: debug level");
commonslogger.error("Test commons.logging: error level");
commonslogger.fatal("Test commons.logging: fatal level");
commonslogger.info("Test commons.logging: info level");
commonslogger.trace("Test commons.logging: trace level");
commonslogger.warn("Test commons.logging: warn level");
log4jlogger.error("Test log4j: error level");
log4jlogger.debug("Test log4j: debug level");
log4jlogger.info("Test log4j: info level");
log4jlogger.trace("Test log4j: trace level");
log4jlogger.warn("Test log4j: warn level");
log4jlogger.fatal("Test log4j: fatal level");
following messages are routed to the file
2013-08-29 10:45:55,061 ERROR l.Log4j2testActivator [Log4j2-Test] Test
log4j: error level
2013-08-29 10:45:55,061 DEBUG l.Log4j2testActivator [Log4j2-Test] Test
log4j: debug level
2013-08-29 10:45:55,061 INFO l.Log4j2testActivator [Log4j2-Test] Test log4j:
info level
2013-08-29 10:45:55,061 TRACE l.Log4j2testActivator [Log4j2-Test] Test
log4j: trace level
2013-08-29 10:45:55,061 WARN l.Log4j2testActivator [Log4j2-Test] Test log4j:
warn level
2013-08-29 10:45:55,061 FATAL l.Log4j2testActivator [Log4j2-Test] Test
log4j: fatal level
following messages are routed to stdout
29.08.2013 10:45:59 log4j2test.Log4j2testActivator run FATAL: Test
commons.logging: error level
29.08.2013 10:45:59 log4j2test.Log4j2testActivator run FATAL: Test
commons.logging: fatal level
29.08.2013 10:45:59 log4j2test.Log4j2testActivator run INFO: Test
commons.logging: info level
29.08.2013 10:45:59 log4j2test.Log4j2testActivator run WARN: Test
commons.logging: warn level
commons-logging.properties
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
log4j.configuration=log4j.properties
log4j.properties
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender which outputs to System.out.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# The conversion pattern uses format specifiers. You might want to
# change the pattern an watch the output format change.
# log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n
log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %c{1} - %m%n
log4j.logger.test=INFO
log4j.logger=INFO
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug" name="logserviceconfiguration" packages="">
<properties>
<property name="filename">logfiles/ACOS-RTU.log</property>
</properties>
<appenders>
<RollingRandomAccessFile name="FastRollingFile" fileName="${filename}"
filePattern="logfiles/ACOS-RTU-%d{MM-dd-yyyy}.log.gz">
<PatternLayout>
<pattern>%d %p %c{1.} [%t] %m%ex%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="1 MB"/>
<OnStartupTriggeringPolicy/>
</Policies>
</RollingRandomAccessFile>
</appenders>
<loggers>
<root level="trace">
<appender-ref ref="FastRollingFile"/>
</root>
</loggers>
</configuration>
--
View this message in context:
http://apache-logging.6191.n7.nabble.com/Using-log4j-jcl-and-log4j-1-2-api-in-an-OSGi-environment-tp40231p40247.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]