[logback-user] Help with logback configuration

David Roussel nabble at diroussel.xsmail.com
Sun Feb 6 15:24:15 CET 2011


It's not clear if you want to have more than once process write to a single
file. That can be done, but is best avoided.  If you want to have one file
aggregating the activity of mulitple processes, then consider sending the
data to a single process which then writes the file.

As for why your config is not working, did you try this?
-Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener


jaybytez wrote:
> 
> Thanks for your help...I just switched from log4j to slf4j/logback and
> this is one issue holding us up from moving to QA/UAT...so I am on a fire
> drill.
> 
> If what I have here is not the right way to think about logging for my
> scenario...please let me know.
> 
> I have multiple variations I have tried, but I will list the two here.
> 
> WLS 11g, in my war [SLF4J 1.6.1 api/ext, Logback 0.9.27 core/classic,
> log4j-over-slf4j 1.6.1, jcl-over-slf4j 1.6.1]
> 
> I have multiple wars that run in 1+ managed instances of WLS that write to
> the same central log files.  Trying to have one central log and each
> application have their individual log files (but one across the managed
> instances...unless it's easier for each managed instance to have its own
> copy).
> 
> 1) I included slf4j/logback jars in WLS lib directory and add one
> logback.xml file into the main/resources directory so when the war is
> built it gets put into WEB-INF/classes of the war.
> - No log files are produced at all, not even writing a 0 byte file.
> 2) I included slf4j/logback in a preclasspath folder that I add into WLS
> startup scripts and I also added
> -Dlogback.configurationFile=%DOMAIN_HOME%\lib\logback.xml into the startup
> script.  I excluded a configuration file from the war.  
> - Log files are created, but nothing is printed to any of the log files.
> 
> Here is my config:
> <configuration>
> 
>   <appender name="sc-resources.log"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>     <prudent>true</prudent> 
>     <rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>       <!-- daily rollover -->
>      
> <fileNamePattern>./logs/sc-resources.%d{yyyy-MM-dd}.log</fileNamePattern>
>       
>       <!-- keep 30 days worth of history -->
>       <maxHistory>30</maxHistory> 
>     </rollingPolicy>
>     <encoder>
>       <pattern>%d [%thread] %level %logger - %m%n</pattern>
>     </encoder>
>   </appender>
> 
>   <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
>     <encoder>
>       <pattern>%d [%thread] %level %logger - %m%n</pattern>
>     </encoder>
>   </appender>
>   
>   <logger name="com.foo.service.mem" level="trace">
>     <appender-ref ref="MemberSearchBusinessService" />
>   </logger>
>   
>   <appender name="MemberBusinessService"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>     <prudent>true</prudent>
>     <rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>       <!-- daily rollover -->
>      
> <fileNamePattern>./logs/MemberBusinessService%d{yyyy-MM-dd}.log</fileNamePattern>
>       
>       <!-- keep 30 days worth of history -->
>       <maxHistory>30</maxHistory> 
>     </rollingPolicy>
>     <encoder>
>       <pattern>%d [%thread] %level %logger - %m%n</pattern>
>     </encoder>
>   </appender>
> 
>   <logger name="com.foo.service.mem" level="trace">
>     <appender-ref ref="MemberBusinessService" />
>   </logger>
>   
>   <logger name="org.apache.cxf" level="debug">
>     <appender-ref ref="sc-resources.log" />
>   </logger>
>   
>   <logger name="org.hibernate" level="warn">
>     <appender-ref ref="sc-resources.log" />
>   </logger>
>   
>   <logger name="org.quartz" level="warn">
>     <appender-ref ref="sc-resources.log" />
>   </logger>
>   
>   <logger name="org.springframework" level="warn">
>     <appender-ref ref="sc-resources.log" />
>   </logger>
> 
>   <root level="trace">
>     <appender-ref ref="stdout" />
>     <appender-ref ref="sc-resources.log"/>
>   </root>
> </configuration>
> 
> Thanks for your help....jay
> 

-- 
View this message in context: http://old.nabble.com/Help-with-logback-configuration-tp30846851p30856858.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list