[logback-user] multiple servlet with differents files in glassfish
Pablo Martínez Campo
pmartinez at tlmat.unican.es
Tue May 27 18:19:21 CEST 2014
I am trying to deploy 2 servlets in glassfish with log4f library.
I have no problems in tomcat. Each servlet writes in its own file but in
tomcat, I found this guide
https://blogs.oracle.com/naman/entry/configure_log4j_for_use_in to
configure and support log4f library.
I got the first servlet working with it. And it writes logs in its log
file. But whenever I deploy the secod servlet, I don't see its logs. The
first one keeps writing in its own file but the second one not.
I modify the logback.xml file included in config folder to include both
files and all packages but it seems to ignore it. This is my logback.xml
file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level
%logger{5} - %msg%n</pattern>
</encoder>
</appender>
<logger name="com.lordofthejars.foo" level="INFO"
additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<appender name="SERVER-FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->0
<fileNamePattern>/root/glassfish4/glassfish/domains/domain1/logs/serverregister-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- keep 7 days' worth of history -->
<maxHistory>7</maxHistory>
<TimeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<MaxFileSize>512MB</MaxFileSize>
</TimeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<append>true</append>
<encoder>
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} [%p]
%logger{5}:%L - %msg%n</pattern>
</encoder>
</appender>
<appender name="REGMAN-FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<!--<fileNamePattern>${catalina.home}/logs/registermanager-%d{yyyy-MM-dd}.%i.log</fileNamePattern>-->
<fileNamePattern>/root/glassfish4/glassfish/domains/domain1/logs/registermanager-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- keep 7 days' worth of history -->
<maxHistory>7</maxHistory>
<TimeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<MaxFileSize>512MB</MaxFileSize>
</TimeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<append>true</append>
<encoder>
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} [%p]
%logger{5}:%L - %msg%n</pattern>
</encoder>
</appender>
<logger
name="com.eu.iotapi.handlers.AuthenticationGatewayHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.handlers.AuthenticationHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.handlers.DeviceValidationHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.handlers.EventValidationHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.handlers.GatewayValidationHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.handlers.ObservationValidationHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.resources.PublicationsResource" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.resources.RegisterDeviceOnBackground" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.resources.RegisterGatewayOnBackground" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.resources.RegistrationResource" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.resources.SubmitEventOnBackground" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.resources.SubmitObservationOnBackground"
level="DEBUG" additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.uns.device.RegisterDeviceHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.uns.events.SubmitEventsHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.uns.device.RegisterGatewayHandler" level="DEBUG"
additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.iotapi.uns.observations.SubmitObservationsHandler"
level="DEBUG" additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger name="com.eu.iotapi.resources.DeviceTranslator"
level="DEBUG" additivity="false">
<appender-ref ref="SERVER-FILE"/>
</logger>
<logger
name="com.eu.registermanager.eventbroker.device.registration.DeviceRegistrationHandler"
level="DEBUG" additivity="false">
<appender-ref ref="REGMAN-FILE"/>
</logger>
<logger
name="com.eu.registermanager.eventbroker.gateway.GatewayRegistrationHandler"
level="DEBUG" additivity="false">
<appender-ref ref="REGMAN-FILE"/>
</logger>
<logger
name="com.eu.registermanager.handlers.AuthenticationGatewayHandler"
level="DEBUG" additivity="false">
<appender-ref ref="REGMAN-FILE"/>
</logger>
<logger
name="com.eu.registermanager.handlers.AuthenticationHandler"
level="DEBUG" additivity="false">
<appender-ref ref="REGMAN-FILE"/>
</logger>
<logger
name="com.eu.registermanager.resources.RegisterDeviceOnEventBrokerOnBackground"
level="DEBUG" additivity="false">
<appender-ref ref="REGMAN-FILE"/>
</logger>
<logger
name="com.eu.registermanager.resources.RegisterGatewayOnEventBrokerOnBackground"
level="DEBUG" additivity="false">
<appender-ref ref="REGMAN-FILE"/>
</logger>
<logger
name="com.eu.registermanager.resources.RegisterResource" level="DEBUG"
additivity="false">
<appender-ref ref="REGMAN-FILE"/>
</logger>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>
More information about the Logback-user
mailing list