[slf4j-user] Logging to file with slf4j.Logger. Where do log file go?

Ceki Gulcu ceki at qos.ch
Thu Mar 19 15:49:09 CET 2009


Hello Tom,

The following mailing list archives which are all mentioned in 
http://slf4j.org/mailing-lists.html are searchable:

http://news.gmane.org/gmane.comp.java.slf4j.user
http://marc.theaimsgroup.com/?l=slf4j-user
http://www.nabble.com/Slf4J---user-f13203.html
http://www.mail-archive.com/user%40slf4j.org/


Which jar files have you placed on your class path?

For FileAppender the file attribute should be:

   <file>c:/testlog1.log</file>

Tom Martin Norvang wrote:
> Hi i am new to slf4j and have a few questions. I could not find out how 
> to search the mailing list for older messages that might contain this 
> subject. And i have searched everywhere online :)..almost.
> 
> 1. Where do log files go when using the slf4j.Logger, f.ex;
> 
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> 
> public class Testing {
>    
>     private static final Logger LOGGER = 
> LoggerFactory.getLogger(Testing.class);
> 
>     public static void main(String[] args) {
>        
>         int value = 10;
>         LOGGER.debug("the variable value ="+value);
>         LOGGER.debug("The value of value = "+value);
>     }
> }
> 
> I am currently using eclipse, project structure and have placed a 
> logback.xml file under the project root folder. The logback.xml file is 
> an example file from the slf4j homepage;
> <configuration>
> 
>   <appender name="FILE" class="ch.qos.logback.core.FileAppender">
>     <file>"c:\testlog1.log"</file>
> 
>     <layout class="ch.qos.logback.classic.PatternLayout">
>       <Pattern>%date %level [%thread] %logger{10} [%file:%line] 
> %msg%n</Pattern>
>     </layout>
>   </appender>
> 
>   <root>
>     <level value="debug" />
>     <appender-ref ref="FILE" />
>   </root>
> </configuration>
> 
> No complaining about the slf4j jar files either.
> The small application runs fine but i suspect that my logback.xml file 
> is not in the right place and not read at all. I have tried to put it in 
> several locations (JAVA_HOME, path, src folder etc). to no avail. I also 
> did a search trough the whole disc, but no such file(testlog1.log). Any 
> ideas what i am doing wrong. By the way i am on WinXP SP2 with 
> JDK1.6.11. Installed.
> 
> Regards Tom Martin
> 
> 
-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list