java - Migrated to logback on weblogic, but is not logging -
i running poc see impact of migrating our j2ee applications logback. spent time on official website , apparently, change beside new jars logback.xml file. unfortunatly doesn't enough, deployment works , log file created well, nothing logged (empty).
my code has following statements
import org.slf4j.logger; import org.slf4j.loggerfactory; private static final logger log = loggerfactory.getlogger(customerservicebean.class); log.debug("test log - customer id " + input.getcustomerid());
pom.xml has following
<dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-classic</artifactid> <version>0.9.18</version> </dependency>
logback.xml (created using web utility official website)
<configuration> <appender name="file" class="ch.qos.logback.core.rolling.rollingfileappender"> <!--see http://logback.qos.ch/manual/appenders.html#rollingfileappender--> <file>/var/log/dcs-3/dcs3.log</file> <encoder> <pattern>%d{absolute} %5p %c{1}:%l - %m%n</pattern> </encoder> <rollingpolicy class="ch.qos.logback.core.rolling.fixedwindowrollingpolicy"> <maxindex>1</maxindex> <filenamepattern>/var/log/dcs-3/dcs3.log.%i</filenamepattern> </rollingpolicy> <triggeringpolicy class="ch.qos.logback.core.rolling.sizebasedtriggeringpolicy"> <maxfilesize>1mb</maxfilesize> </triggeringpolicy> </appender> <logger name="com.lgi.dcs" level="debug" /> <root level="debug"> <appender-ref ref="file"/> </root> </configuration>
any idea? thanks
update
made few more changes suggested. issue still open, able obtain more information.
logged error instead of simple debug. removed log4j jars or dependencies project , added log4j-bridge. changed logback.xml 1 more generic taken post , used appender on console in addition file.
now in ide looks logger instance implemented ch.qos.locback.classic.logger. log file still empty, if delete recreated during server start-up. on server log can see test message like:
slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [zip:/opt/oracle-soa/user_projects/domains/osb/servers/adminserver/tmp/_wl_user/dcs3-ear-3/9yhkv9/app-inf/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [zip:/opt/oracle-soa/user_projects/domains/osb/servers/adminserver/tmp/_wl_user/dcs3-ear-3/9yhkv9/app-inf/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. 11:40:17.902 [[active] executethread: '12' queue: 'weblogic.kernel.default (self-tuning)'] error c.l.d.s.customer.customerservicebean - test log - customer id 6107576
which how makes me think log4j within weblogic perhaps.
as have mentioned above, logger factory returns instance of log4j not logback. means still have log4j on classpath. directly provided , left there mistake, or comes dependency libraries using. if using maven, try investigate effective pom log4j existatnce, , exclude them. otherwise have manually. if find dependency, deleting should trick.
the jar should slf4j bridge log4j-over-slf4j. jcl-over-slf4j related too.
Comments
Post a Comment