[logback-user] Multiple files and other issues

Marco Bresciani m.bresciani at email.it
Thu Mar 5 23:45:45 CET 2009


Hello all,
  I've just began using Logback and it is sooo good! :-) I'm still a newbie so
for my attempts I'm using the online wizard and then trying to adapting and
customizing it by hand, when needed, in order to find the correct
configuration for my needs (many packages, many classes, different needs and
logs levels, ...).

I've reached a sort of nirvana by simply using the wizard without any
customization and no other "strange things". I've read the manual again and
again but I'm still having some problems, anyway. :-( (I'm going to feel the
dark side of the newbies...) Could anyone please help? (At the end of the
email, an example logback.xml I've made with the wizard)

1. I've tried to use HTML file format, even with a very simple/basic
configuration, but no output has been produced;

2. I'm getting crazy trying to have a customizable/variable file name. If two
instances of my application run; I need to have two logs. I.e.: first instance
being ran at 10.30, second instance being ran at 11.04 then the log files
should be something like logs/MyApp at 10.30.45.log and logs/MyApp at 11.04.32.log.
I really need this and I'm getting crazy... Please help!

3. I'm still having a bit of troubles in splitting the logs of specific parts
or packages or sub-applications, through different log files. I.e.:
logs/MyApp at 10.30.45.log and logs/MyApp_SpecialPackage at 10.30.46.log and so on.
Is the XML made by the wizard correct?



Really really thanks in advance for any help anyone could give me,


Marco


This is an example of what I've done... many attempts...

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <appender class="ch.qos.logback.core.FileAppender"
name="my.special.package.logger.thingFileAppender">
   <file>traces/SpecialPackage</file>
   <append>true</append>
   <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
     <level>error</level>
   </filter>
   <layout class="ch.qos.logback.classic.PatternLayout">
     <pattern>%d{yyyy-MM-dd HH:mm:ss},%p,%c,%t,%C{1},%M %m%n</pattern>
   </layout>
 </appender>
 <appender class="ch.qos.logback.core.FileAppender" name="RootFileAppender">
   <file>traces/MyApp</file>
   <append>false</append>
   <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
     <level>error</level>
   </filter>
   <layout class="ch.qos.logback.classic.PatternLayout">
     <pattern>%d{yyyy-MM-dd HH:mm:ss},%p,%c,%F,%C{1} %m%n</pattern>
   </layout>
 </appender>
 <logger additivity="false" name="my.special.package.logger.thing">
   <level value="error"/>
   <appender-ref ref="my.special.package.logger.thingFileAppender"/>
 </logger>
 <root>
   <level value="debug"/>
   <appender-ref ref="RootFileAppender"/>
 </root>
</configuration>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5248 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://qos.ch/pipermail/logback-user/attachments/20090305/ccb5a917/attachment.bin>


More information about the Logback-user mailing list