[logback-user] configuring logback to log to two different

øyvind rotnes rotnes at gmail.com
Mon May 12 18:10:57 CEST 2008


Thanks for the help.
I found out what was wrong.
I am using EJB 3.0 interceptors, and the proxied objects have another
package name than the real objects. When I changed
UserActionLoggerFactory.getLogger(); to use the proxied objects
packages it worked :)



On Mon, May 12, 2008 at 5:43 PM, Gibbons, P (Paul)
<Paul.gibbons at diamond.ac.uk> wrote:
> Here is my config which writes to file fine:
>
>  <configuration>
>  ...
>     <appender name="DebugFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
>         <File>${gda.users}/logs/gda_server.log</File>
>         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>             <FileNamePattern>${gda.users}/logs/gda_server.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
>         </rollingPolicy>
>
>         <layout class="ch.qos.logback.classic.PatternLayout">
>             <pattern>%d %-5level %logger - %m %ex %n</pattern>
>         </layout>
>     </appender>
>     <root>
>         <level value="ALL"/>
>         <appender-ref ref="DebugFILE"/>
>     </root>
>  </configuration>
>
>
>
>
>  -----Original Message-----
>  From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of øyvind rotnes
>  Sent: 12 May 2008 14:23
>  To: logback-user at qos.ch
>  Subject: [logback-user] configuring logback to log to two different
>
>  Hi. I am new to logback and have some problem with setting up the configuration.
>  I want to add some new functionality to the existing logging configuration that was already in use in the application.
>  I want my application to write log events from the classes that are in the package: "com.my.package"  to a FILE
>  >From the documentation I undestod that this can be done with
>   <logger additivity="false" name="com.my.package">
>                   <level value="debug" />
>                  <appender-ref ref="FILE" />
>   </logger>
>
>  which points to a file appender. My logback.xml is listet below. This configuration prints everything to the console, but nothing to the FILE.
>  Can someone please point out for me where i am doing wrong?
>  Thanks!
>
>
>
>  <configuration debug="true">
>
>   <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
>     <File>c:\temp\testAction.log</File>
>         <append>true</append>
>
>     <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
>       <FileNamePattern>testAction.%i.log.zip</FileNamePattern>
>       <MinIndex>1</MinIndex>
>       <MaxIndex>3</MaxIndex>
>     </rollingPolicy>
>
>     <triggeringPolicy
>  class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
>       <MaxFileSize>5MB</MaxFileSize>
>     </triggeringPolicy>
>     <layout class="ch.qos.logback.classic.PatternLayout">
>       <Pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %X{action}  %msg%n</Pattern>
>     </layout>
>   </appender>
>
>         <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>     <layout class="ch.qos.logback.classic.PatternLayout">
>       <Pattern>%msg%n</Pattern>
>     </layout>
>   </appender>
>
>          <logger additivity="false" name="com.my.package">
>                   <level value="debug" />
>                  <appender-ref ref="FILE" />
>          </logger>
>
>   <root>
>     <level value="debug" />
>     <appender-ref ref="STDOUT" />
>   </root>
>  </configuration>
>
> _______________________________________________
>  Logback-user mailing list
>  Logback-user at qos.ch
>  http://qos.ch/mailman/listinfo/logback-user
>  <DIV><FONT size="1" color="gray">This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
>  Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
>  Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
>  Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
>  </FONT></DIV>
>
>
> _______________________________________________
>  Logback-user mailing list
>  Logback-user at qos.ch
>  http://qos.ch/mailman/listinfo/logback-user
>



More information about the Logback-user mailing list