The "lib" folder is generally not on the classpath; however, JARs within the folder are. If you know that other libraries are being successfully loaded from the "lib" folder, then one thing to try is to create a minimal JAR containing just logback.xml. The other option would be to just package logback.xml with the rest of your application code (which is what Maven does with items under src/main/resources by default).<div>
<br></div><div>-Abraham</div><div><br><br><div class="gmail_quote">On Mon, Aug 27, 2012 at 11:07 AM, Oliver Zemann <span dir="ltr"><<a href="mailto:oliver.zemann@gmail.com" target="_blank">oliver.zemann@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How to reproduce:<br>
<br>
Create a new Java Application in Netbeans with following content:<br>
<br>
package com.logbackanttest;<br>
<br>
import ch.qos.logback.classic.LoggerContext;<br>
import ch.qos.logback.core.util.StatusPrinter;<br>
import org.slf4j.Logger;<br>
import org.slf4j.LoggerFactory;<br>
<br>
public class LogbackAntTest {<br>
private static final Logger LOG = LoggerFactory.getLogger(LogbackAntTest.class);<br>
    /**<br>
     * @param args the command line arguments<br>
     */<br>
    public static void main(String[] args) {<br>
        LOG.trace("TRACING");<br>
        LOG.error("ERROR");<br>
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();<br>
    // print logback's internal status<br>
    StatusPrinter.print(lc);<br>
<br>
    }<br>
}<br>
<br>
Now try to get it working ;)<br>
<br>
I really tried alot, but it makes no difference where i copy the<br>
logback.xml into. I tried it with the dist/ folder, with the lib<br>
folder (which must be in the classpath, otherwise the application<br>
would not start at all).<br>
I have absolutly no idea whats going on - i guess with maven it just<br>
copies the logback.xml into the jar and uses that (i created a<br>
jar-with-dependencies).<br>
<br>
<br>
<br>
2012/8/27 Oliver Zemann <<a href="mailto:oliver.zemann@gmail.com">oliver.zemann@gmail.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> I was able to easily get it working with maven when i copied the file<br>
> into my resources folder, but it is not working with ant. Somehow it<br>
> is not found, in that case all debugging options in the xml makes no<br>
> sense as this is just not found.<br>
><br>
> I tested it with StatusPrinter and printing the LoggerContext:<br>
><br>
> run:<br>
> 12:58:06.590 [main] ERROR com.logbackanttest.LogbackAntTest - ERROR<br>
> 12:58:06,545 |-INFO in ch.qos.logback.classic.LoggerContext[default] -<br>
> Could NOT find resource [logback.groovy]<br>
> 12:58:06,545 |-INFO in ch.qos.logback.classic.LoggerContext[default] -<br>
> Could NOT find resource [logback-test.xml]<br>
> 12:58:06,545 |-INFO in ch.qos.logback.classic.LoggerContext[default] -<br>
> Could NOT find resource [logback.xml]<br>
> 12:58:06,546 |-INFO in ch.qos.logback.classic.LoggerContext[default] -<br>
> Setting up default configuration.<br>
><br>
> I am currently in the project root directory, where a logback.xml is<br>
> located. Also the dist folder (created by netbeans) contains a<br>
> logback.xml and inside this dist folder the folder lib is created<br>
> (containing the 3 jars, logback common, classic and slf4j) where also<br>
> a logback.xml is located.<br>
><br>
> 2012/8/27 Oliver Zemann <<a href="mailto:oliver.zemann@gmail.com">oliver.zemann@gmail.com</a>>:<br>
>> The problem is that the software is running productive on customer<br>
>> side, so there is no way to just deinstall the application and<br>
>> reinstall it...<br>
>><br>
>> * What version of logback and slf4j are you using?<br>
>> logback 1.0.6 (classic and core), slf4j-api 1.6.5<br>
>><br>
>> * Which flavor (and version) of Linux are you running?<br>
>> CentOS 5.8 and 6.3<br>
>><br>
>> * Does the same problem occur when you try your logback config in a simple<br>
>>  HelloWorld app (outside of install4j)?<br>
>> Just tried it with creating a standalone jar from maven<br>
>> (jar-with-dependencies) and its working as expected but its embedded<br>
>> now. will check this in a few moments.<br>
>><br>
>> Regards,<br>
>> Oli<br>
>><br>
>> 2012/8/27 Thorbjørn Ravn Andersen <<a href="mailto:thunderaxiom@hotmail.com">thunderaxiom@hotmail.com</a>>:<br>
>>> Have you enabled automatic printing of status messages in case of warming or<br>
>>> errors?<br>
>>><br>
>>><br>
>>><br>
>>> (see<br>
>>> <a href="http://logback.qos.ch/manual/configuration.html#automaticStatusPrinting" target="_blank">http://logback.qos.ch/manual/configuration.html#automaticStatusPrinting</a>)<br>
>>><br>
>>><br>
>>><br>
>>> It will go to your console.<br>
>>><br>
>>><br>
>>><br>
>>> From: <a href="mailto:logback-user-bounces@qos.ch">logback-user-bounces@qos.ch</a> [mailto:<a href="mailto:logback-user-bounces@qos.ch">logback-user-bounces@qos.ch</a>] On<br>
>>> Behalf Of Tony Trinh<br>
>>> Sent: 25. august 2012 23:57<br>
>>> To: logback users list<br>
>>> Subject: Re: [logback-user] Problem with Logging in Linux<br>
>>><br>
>>><br>
>>><br>
>>> On Fri, Aug 24, 2012 at 6:52 AM, Oliver Zemann <<a href="mailto:oliver.zemann@gmail.com">oliver.zemann@gmail.com</a>><br>
>>> wrote:<br>
>>><br>
>>> Hi, i have the absolut identical file for Windows which works as<br>
>>> expected (logging), but not for linux:<br>
>>><br>
>>> <a href="http://rifers.org/paste/show/1801" target="_blank">http://rifers.org/paste/show/1801</a><br>
>>><br>
>>> There is just no logging - i started everything as root. Even when i<br>
>>> use the FileAppender with its file name property set to "somelog.log"<br>
>>> or "/root/somelog.log" it just saves nothing and i have no idea why.<br>
>>><br>
>>> I used updatedb && locate to find a file called like this but there<br>
>>> was nothing. Also lsof with a grep find nothing opened. So it is<br>
>>> really not logging.<br>
>>><br>
>>> Regards,<br>
>>> Oli<br>
>>><br>
>>><br>
>>><br>
>>> Your config for the RollingFileAppender is missing the <file> element. The<br>
>>> manual contains a good example of all the necessary elements [1]. logback<br>
>>> should print a warning in the debug output for this.<br>
>>><br>
>>><br>
>>><br>
>>> It would be helpful if you provided additional details to reproduce the<br>
>>> problem:<br>
>>><br>
>>><br>
>>><br>
>>>  * What version of logback and slf4j are you using?<br>
>>><br>
>>>  * Which flavor (and version) of Linux are you running?<br>
>>><br>
>>>  * Does the same problem occur when you try your logback config in a simple<br>
>>> HelloWorld app (outside of install4j)?<br>
>>><br>
>>><br>
>>><br>
>>> FYI, your logback config works (writes to a file) for me in Android.<br>
>>><br>
>>><br>
>>><br>
>>> It looks like Install4j supports a console [2], when running  the installer<br>
>>> with "-c". It might be worth seeing if logback's debug-output prints in that<br>
>>> console.<br>
>>><br>
>>><br>
>>><br>
>>> [1]: <a href="http://logback.qos.ch/manual/appenders.html#logback-RollingTimeBased" target="_blank">http://logback.qos.ch/manual/appenders.html#logback-RollingTimeBased</a><br>
>>><br>
>>> [2]: <a href="http://www.ej-technologies.com/products/install4j/whatsnew4.html" target="_blank">http://www.ej-technologies.com/products/install4j/whatsnew4.html</a><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Logback-user mailing list<br>
>>> <a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
>>> <a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br>
_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a></div></div></blockquote></div><br></div>