[logback-user] Logback-user Digest, Vol 37, Issue 6
mohamad mohsen Taheri
mohsen.taheri.1989 at gmail.com
Wed Oct 15 07:43:49 CEST 2014
If you add the jar files to C:\Program Files\Java\jre7\lib\ext . and try to
run the program like below:
- \logback>java Logback
it wont see the logback.xml file in the source directory
when i deleted the
- logback-access-1.1.2.jar
- logback-classic-1.1.2.jar
- logback-core-1.1.2.jar
- slf4j-api-1.7.6.jar
files from C:\Program Files\Java\jre7\lib\ext, it went OK!
On Tue, Oct 14, 2014 at 10:38 AM, <logback-user-request at qos.ch> wrote:
> Send Logback-user mailing list submissions to
> logback-user at qos.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mailman.qos.ch/mailman/listinfo/logback-user
> or, via email, send a message with subject or body 'help' to
> logback-user-request at qos.ch
>
> You can reach the person managing the list at
> logback-user-owner at qos.ch
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Logback-user digest..."
>
>
> Today's Topics:
>
> 1. unable to find logback.xml file in my simple project
> (mohamad mohsen Taheri)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 14 Oct 2014 10:35:38 +0330
> From: mohamad mohsen Taheri <mohsen.taheri.1989 at gmail.com>
> To: logback-user at qos.ch
> Subject: [logback-user] unable to find logback.xml file in my simple
> project
> Message-ID:
> <CACKNU3jim9BNCogSqCn-VrzJBvmfFrOK4E=
> QeNNf0eCF3gyjvw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I'm trying to use logback as my logger in my simple program but it does not
> work fine! I put logback/logback.xml and logback/Logback.java in the source
> directory logback and run through this command line
>
> - \logback>java -cp .;%CLASSPATH% Logback
>
> which the %CLASSPATH% is an environment variable that has the path of .jar
> file that logback needs like:
>
> - logback-access-1.1.2.jar
> - logback-classic-1.1.2.jar
> - logback-core-1.1.2.jar
> - slf4j-api-1.7.6.jar
>
> This is my logback.xml file
>
> <configuration>
> <appender name="FILE"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>
> <file>test.log</file>
>
> <rollingPolicy
> class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
> <fileNamePattern>tests.%i.log</fileNamePattern>
> <minIndex>1</minIndex>
> </rollingPolicy>
>
> <triggeringPolicy
> class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
> <maxFileSize>2MB</maxFileSize>
> </triggeringPolicy>
>
> <encoder>
> <pattern>%date %level [%thread] %logger{10} [%file:%line]
> %msg%n</pattern>
> </encoder>
>
> </appender>
>
> <root level="debug">
> <appender-ref ref="FILE" />
> </root></configuration>
>
> and there is my simple program
>
> import org.slf4j.Logger;import org.slf4j.LoggerFactory;
> public class Logback{
> private final static Logger logger =
> LoggerFactory.getLogger(Logback.class);
>
> public static void main(String[] args){
> for(int i=0;i<1000000;i++)
> logger.debug("hello");
> }}
>
> but unfortunately i just receive log in the console instead of test.log
> files. it seems the logger object just use the default configuration!!!
>
> If i set the -Dlogback.configurationFile=logback.xml variable as below, it
> works properly. but how to run without this variable?
>
> - \logback>java -cp .;%CLASSPATH%
> -Dlogback.configurationFile=logback.xml Logback
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.qos.ch/pipermail/logback-user/attachments/20141014/b26d2329/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
> ------------------------------
>
> End of Logback-user Digest, Vol 37, Issue 6
> *******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20141015/5291801d/attachment.html>
More information about the Logback-user
mailing list