logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tommmmmm <tommm...@gmail.com>
Subject Re: Log4J doesn't work at all
Date Tue, 10 Apr 2012 21:06:20 GMT
On 10 April 2012 22:30, Jacob Kjome <hoju@visi.com> wrote:

>
> In your other email you say...
>
>
>  Running command line. From within NetBeans. No fancy stuff.
>>
>
> Never discount the complexity of an IDE and how it forks JVMs and/or
> performs idiosyncratic classloading.
>
>
I load/run only 1 JVM at a time. 1 Thread I might add. No forking here.


> In any case, your test below is invalid in this context.  You claimed, in
> an earlier response, that you load your config manually using...
>
>     PropertyConfigurator.**configure("./src/logging/**log4j.properties");
>
> The output you see from Log4j, ending with the line...
>
>
>     log4j: Could not find resource: [null].
>
>
As the log4j debug stays, the file is being found and loaded after all.


> ...just means that Log4j default config lookup didn't find a Log4j config
> file in the root of the classpath.  That's normal if you didn't put it
> there.  But because you manually configure, your config is loaded, so you
> can ignore the above line.
>
> The one odd thing I see is that there is a logger named "jobManager" that
> is configured.  I don't see that in the log4 config you posted in a
> previous response (see below).  Are you sure the config file that is being
> loaded is the one you **think** is being loaded?
>
>
First, I have to make it work. I can always add an entry in proprties file
for a specific class later on. First it must work - then I will worry about
details.


>
>  I copy pasted
>>
>> log4j.rootLogger=INFO, stdout
>>
>> log4j.appender.stdout=org.**apache.log4j.ConsoleAppender
>> log4j.appender.stdout.layout=**org.apache.log4j.PatternLayout
>> log4j.appender.stdout.layout.**ConversionPattern=%5p [%c] %m%n
>>
>> log4j.logger.org.apache.http=**DEBUG
>> log4j.logger.org.apache.http.**wire=ERROR
>>
>> Into a file I named log4j.properties that I put into src folder a'ka
>> <default package>
>>
>
> BTW, why do you configure a properties file from a "src" folder.  Why not
> just copy that into some folder on the classpath and let Log4j
> auto-configure.  Besides, your methodology of using...
>
>     PropertyConfigurator.**configure("./src/logging/**log4j.properties");
>
> ...suffers from the fact that this is a file path, relative to the
> directory from which the JVM started.


Alright. It will change. But it's on my super bottom list of worries. I
first have to make it work. Then worry about the rest.


> That is bound to change from environment to environment and, therefore,
> brittle.  Just stick it in the classpath and let Log4j pick it up.
>
>
>
Has been already done sir ^^ Didn't help :(


>
> Jake
>
>
:(

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message