You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by rhaiger <rh...@gmail.com> on 2012/01/23 20:45:00 UTC

Problems with log4j configuration

Hello guys, I'm new in this forum and I think you may help me with an
issue...

I'm trying to use log4j to log some login auditing informations, and I'm
using JBoss 4 and Java with compliance level 5.0. It's a very old legacy
system...

I've added this lines at my log4j.xml:

<appender name="AUDITOR"
class="org.jboss.logging.appender.RollingFileAppender">
    <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
    
    
    
    
    <layout class="org.apache.log4j.PatternLayout">
        
    </layout>	    
</appender>

<category name="com.itautec.siac.controleAcesso" additivity="false">
    <priority value="INFO"/>
    <appender-ref ref="AUDITOR"/>
</category>

And in my Foo.java class, I've added this field:

private static final Logger logger = Logger.getLogger(Foo.class);

When I want to log something (inside my Foo.java class), I just call my
logger with something like:

logger.info("any message");


Well, after that, I start JBoss4, and I can see that Auditor.log file is
created in my log folder, as it should be, but everything I try to log
doesn't appear in my Auditor.log file... :-(

When I start my application in debug mode, I can see that I'm passing
through several loggers that I've put in my Foo.java class, but it seems
that log4j is just ignoring these callings and nothing is logged at all...

Does anyone know what's happening? It seems to be something really simple,
but I can't figure it out! :-((

Thanks from now and best regards! :-)
-- 
View this message in context: http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33190553.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Problems with log4j configuration

Posted by rhaiger <rh...@gmail.com>.
I've noticed a very strange thing just now!

While debugging, I've stoped in a point when my logger is called to log
something... But when I evaluate my logger, it says: "logger cannot be
resolved"

This is very bizarre, cause when I try to log something with
logger.info("bla") for example, it doesn't throws any exception... %-|


rhaiger wrote:
> 
> Hi bmelloni!
> 
> Thanks for all these good sugestions, but unfortunately none worked for
> me... :-((
> 
> What I've done:
> 
> 1) Look in server.log and see if your entries might be going there.
>     I've used grep in all my log files and my application console, and a
> random string that I've put there didn't appeared... I've used a break
> point in debug mode to be sure that my logger was called... :confused:
> 2) Check for typos.
>     I've double checked for typos, but I don't think this is the case...
> 3) Try implementing your AUDITOR appender by cut/pasting the FILE appender
> that is there as a starting point.
>     I've made this too, copying and pasting another configuration logger
> that's already working in another package, but it didn't work too... :-((
> 4) Instead of using static and specifying the class use "private final
> Logger logger = Logger.getLogger(this.getClass());"
>     I've tried this strategy too, and it was not effective again... :,(
> 
> 
> I really have no idea what might be happening... It seems that everything
> is alright, but my Auditor.log keeps empty... :confused:
> 
> 
> bmelloni wrote:
>> 
>> Looks right to me, but I don't remember the RollingFileAppender
>> parameters.
>> 
>> I suggest you:
>> 
>> 1) Look in server.log and see if your entries might be going there.
>> 2) Check for typos.
>> 3) Try implementing your AUDITOR appender by cut/pasting the FILE
>> appender that is there as a starting point.
>> 4) Instead of using static and specifying the class use "private final
>> Logger logger = Logger.getLogger(this.getClass());"
>> 
>> -----Original Message-----
>> From: rhaiger [mailto:rhaiger@gmail.com] 
>> Sent: Monday, January 23, 2012 1:45 PM
>> To: log4j-user@logging.apache.org
>> Subject: Problems with log4j configuration
>> 
>> 
>> Hello guys, I'm new in this forum and I think you may help me with an
>> issue...
>> 
>> I'm trying to use log4j to log some login auditing informations, and I'm
>> using JBoss 4 and Java with compliance level 5.0. It's a very old legacy
>> system...
>> 
>> I've added this lines at my log4j.xml:
>> 
>> <appender name="AUDITOR"
>> class="org.jboss.logging.appender.RollingFileAppender">
>>     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
>>     
>>     
>>     
>>     
>>     <layout class="org.apache.log4j.PatternLayout">
>>         
>>     </layout>	    
>> </appender>
>> 
>> <category name="com.itautec.siac.controleAcesso" additivity="false">
>>     <priority value="INFO"/>
>>     <appender-ref ref="AUDITOR"/>
>> </category>
>> 
>> And in my Foo.java class, I've added this field:
>> 
>> private static final Logger logger = Logger.getLogger(Foo.class);
>> 
>> When I want to log something (inside my Foo.java class), I just call my
>> logger with something like:
>> 
>> logger.info("any message");
>> 
>> 
>> Well, after that, I start JBoss4, and I can see that Auditor.log file is
>> created in my log folder, as it should be, but everything I try to log
>> doesn't appear in my Auditor.log file... :-(
>> 
>> When I start my application in debug mode, I can see that I'm passing
>> through several loggers that I've put in my Foo.java class, but it seems
>> that log4j is just ignoring these callings and nothing is logged at
>> all...
>> 
>> Does anyone know what's happening? It seems to be something really
>> simple, but I can't figure it out! :-((
>> 
>> Thanks from now and best regards! :-)
>> --
>> View this message in context:
>> http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33190553.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33194443.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Problems with log4j configuration

Posted by rhaiger <rh...@gmail.com>.
Hi bmelloni!

Thanks for all these good sugestions, but unfortunately none worked for
me... :-((

What I've done:

1) Look in server.log and see if your entries might be going there.
    I've used grep in all my log files and my application console, and a
random string that I've put there didn't appeared... I've used a break point
in debug mode to be sure that my logger was called... :confused:
2) Check for typos.
    I've double checked for typos, but I don't think this is the case...
3) Try implementing your AUDITOR appender by cut/pasting the FILE appender
that is there as a starting point.
    I've made this too, copying and pasting another configuration logger
that's already working in another package, but it didn't work too... :-((
4) Instead of using static and specifying the class use "private final
Logger logger = Logger.getLogger(this.getClass());"
    I've tried this strategy too, and it was not effective again... :,(


I really have no idea what might be happening... It seems that everything is
alright, but my Auditor.log keeps empty... :confused:


bmelloni wrote:
> 
> Looks right to me, but I don't remember the RollingFileAppender
> parameters.
> 
> I suggest you:
> 
> 1) Look in server.log and see if your entries might be going there.
> 2) Check for typos.
> 3) Try implementing your AUDITOR appender by cut/pasting the FILE appender
> that is there as a starting point.
> 4) Instead of using static and specifying the class use "private final
> Logger logger = Logger.getLogger(this.getClass());"
> 
> -----Original Message-----
> From: rhaiger [mailto:rhaiger@gmail.com] 
> Sent: Monday, January 23, 2012 1:45 PM
> To: log4j-user@logging.apache.org
> Subject: Problems with log4j configuration
> 
> 
> Hello guys, I'm new in this forum and I think you may help me with an
> issue...
> 
> I'm trying to use log4j to log some login auditing informations, and I'm
> using JBoss 4 and Java with compliance level 5.0. It's a very old legacy
> system...
> 
> I've added this lines at my log4j.xml:
> 
> <appender name="AUDITOR"
> class="org.jboss.logging.appender.RollingFileAppender">
>     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
>     
>     
>     
>     
>     <layout class="org.apache.log4j.PatternLayout">
>         
>     </layout>	    
> </appender>
> 
> <category name="com.itautec.siac.controleAcesso" additivity="false">
>     <priority value="INFO"/>
>     <appender-ref ref="AUDITOR"/>
> </category>
> 
> And in my Foo.java class, I've added this field:
> 
> private static final Logger logger = Logger.getLogger(Foo.class);
> 
> When I want to log something (inside my Foo.java class), I just call my
> logger with something like:
> 
> logger.info("any message");
> 
> 
> Well, after that, I start JBoss4, and I can see that Auditor.log file is
> created in my log folder, as it should be, but everything I try to log
> doesn't appear in my Auditor.log file... :-(
> 
> When I start my application in debug mode, I can see that I'm passing
> through several loggers that I've put in my Foo.java class, but it seems
> that log4j is just ignoring these callings and nothing is logged at all...
> 
> Does anyone know what's happening? It seems to be something really simple,
> but I can't figure it out! :-((
> 
> Thanks from now and best regards! :-)
> --
> View this message in context:
> http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33190553.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33194364.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Problems with log4j configuration

Posted by rhaiger <rh...@gmail.com>.
Hi Bart!

I've checked and I'm importing log4j correctly... =)

Here's the import line: import org.apache.log4j.Logger;

Thanks for the help! :-)


Bart Berger wrote:
> 
> If you let your IDE add the import statements, double-check that you're
> importing log4j's Logger and not JBoss's Logger.
> 
> Cheers,
> Bart
> 
> -----Original Message-----
> From: BRUNO MELLONI [mailto:Bruno.Melloni@chickasaw.net] 
> Sent: Monday, January 23, 2012 11:58 AM
> To: Log4J Users List
> Subject: RE: Problems with log4j configuration
> 
> Looks right to me, but I don't remember the RollingFileAppender
> parameters.
> 
> I suggest you:
> 
> 1) Look in server.log and see if your entries might be going there.
> 2) Check for typos.
> 3) Try implementing your AUDITOR appender by cut/pasting the FILE appender
> that is there as a starting point.
> 4) Instead of using static and specifying the class use "private final
> Logger logger = Logger.getLogger(this.getClass());"
> 
> -----Original Message-----
> From: rhaiger [mailto:rhaiger@gmail.com] 
> Sent: Monday, January 23, 2012 1:45 PM
> To: log4j-user@logging.apache.org
> Subject: Problems with log4j configuration
> 
> 
> Hello guys, I'm new in this forum and I think you may help me with an
> issue...
> 
> I'm trying to use log4j to log some login auditing informations, and I'm
> using JBoss 4 and Java with compliance level 5.0. It's a very old legacy
> system...
> 
> I've added this lines at my log4j.xml:
> 
> <appender name="AUDITOR"
> class="org.jboss.logging.appender.RollingFileAppender">
>     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
>     
>     
>     
>     
>     <layout class="org.apache.log4j.PatternLayout">
>         
>     </layout>	    
> </appender>
> 
> <category name="com.itautec.siac.controleAcesso" additivity="false">
>     <priority value="INFO"/>
>     <appender-ref ref="AUDITOR"/>
> </category>
> 
> And in my Foo.java class, I've added this field:
> 
> private static final Logger logger = Logger.getLogger(Foo.class);
> 
> When I want to log something (inside my Foo.java class), I just call my
> logger with something like:
> 
> logger.info("any message");
> 
> 
> Well, after that, I start JBoss4, and I can see that Auditor.log file is
> created in my log folder, as it should be, but everything I try to log
> doesn't appear in my Auditor.log file... :-(
> 
> When I start my application in debug mode, I can see that I'm passing
> through several loggers that I've put in my Foo.java class, but it seems
> that log4j is just ignoring these callings and nothing is logged at all...
> 
> Does anyone know what's happening? It seems to be something really simple,
> but I can't figure it out! :-((
> 
> Thanks from now and best regards! :-)
> --
> View this message in context:
> http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33190553.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33194369.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Problems with log4j configuration

Posted by Bart Berger <bb...@Brocade.COM>.
If you let your IDE add the import statements, double-check that you're importing log4j's Logger and not JBoss's Logger.

Cheers,
Bart

-----Original Message-----
From: BRUNO MELLONI [mailto:Bruno.Melloni@chickasaw.net] 
Sent: Monday, January 23, 2012 11:58 AM
To: Log4J Users List
Subject: RE: Problems with log4j configuration

Looks right to me, but I don't remember the RollingFileAppender parameters.

I suggest you:

1) Look in server.log and see if your entries might be going there.
2) Check for typos.
3) Try implementing your AUDITOR appender by cut/pasting the FILE appender that is there as a starting point.
4) Instead of using static and specifying the class use "private final Logger logger = Logger.getLogger(this.getClass());"

-----Original Message-----
From: rhaiger [mailto:rhaiger@gmail.com] 
Sent: Monday, January 23, 2012 1:45 PM
To: log4j-user@logging.apache.org
Subject: Problems with log4j configuration


Hello guys, I'm new in this forum and I think you may help me with an issue...

I'm trying to use log4j to log some login auditing informations, and I'm using JBoss 4 and Java with compliance level 5.0. It's a very old legacy system...

I've added this lines at my log4j.xml:

<appender name="AUDITOR"
class="org.jboss.logging.appender.RollingFileAppender">
    <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
    
    
    
    
    <layout class="org.apache.log4j.PatternLayout">
        
    </layout>	    
</appender>

<category name="com.itautec.siac.controleAcesso" additivity="false">
    <priority value="INFO"/>
    <appender-ref ref="AUDITOR"/>
</category>

And in my Foo.java class, I've added this field:

private static final Logger logger = Logger.getLogger(Foo.class);

When I want to log something (inside my Foo.java class), I just call my logger with something like:

logger.info("any message");


Well, after that, I start JBoss4, and I can see that Auditor.log file is created in my log folder, as it should be, but everything I try to log doesn't appear in my Auditor.log file... :-(

When I start my application in debug mode, I can see that I'm passing through several loggers that I've put in my Foo.java class, but it seems that log4j is just ignoring these callings and nothing is logged at all...

Does anyone know what's happening? It seems to be something really simple, but I can't figure it out! :-((

Thanks from now and best regards! :-)
--
View this message in context: http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33190553.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Problems with log4j configuration

Posted by BRUNO MELLONI <Br...@chickasaw.net>.
Looks right to me, but I don't remember the RollingFileAppender parameters.

I suggest you:

1) Look in server.log and see if your entries might be going there.
2) Check for typos.
3) Try implementing your AUDITOR appender by cut/pasting the FILE appender that is there as a starting point.
4) Instead of using static and specifying the class use "private final Logger logger = Logger.getLogger(this.getClass());"

-----Original Message-----
From: rhaiger [mailto:rhaiger@gmail.com] 
Sent: Monday, January 23, 2012 1:45 PM
To: log4j-user@logging.apache.org
Subject: Problems with log4j configuration


Hello guys, I'm new in this forum and I think you may help me with an issue...

I'm trying to use log4j to log some login auditing informations, and I'm using JBoss 4 and Java with compliance level 5.0. It's a very old legacy system...

I've added this lines at my log4j.xml:

<appender name="AUDITOR"
class="org.jboss.logging.appender.RollingFileAppender">
    <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
    
    
    
    
    <layout class="org.apache.log4j.PatternLayout">
        
    </layout>	    
</appender>

<category name="com.itautec.siac.controleAcesso" additivity="false">
    <priority value="INFO"/>
    <appender-ref ref="AUDITOR"/>
</category>

And in my Foo.java class, I've added this field:

private static final Logger logger = Logger.getLogger(Foo.class);

When I want to log something (inside my Foo.java class), I just call my logger with something like:

logger.info("any message");


Well, after that, I start JBoss4, and I can see that Auditor.log file is created in my log folder, as it should be, but everything I try to log doesn't appear in my Auditor.log file... :-(

When I start my application in debug mode, I can see that I'm passing through several loggers that I've put in my Foo.java class, but it seems that log4j is just ignoring these callings and nothing is logged at all...

Does anyone know what's happening? It seems to be something really simple, but I can't figure it out! :-((

Thanks from now and best regards! :-)
--
View this message in context: http://old.nabble.com/Problems-with-log4j-configuration-tp33190553p33190553.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Problems with log4j configuration [SOLVED]

Posted by rhaiger <rh...@gmail.com>.
Well guys!

I finally made it... The problem was not with log4j, but with the EAR
generation of the legacy code I have here... >-(

Thanks for the help and for the hints! They'll be usefull in the future for
sure... :-D


rhaiger wrote:
> 
> Hello guys, I'm new in this forum and I think you may help me with an
> issue...
> 
> I'm trying to use log4j to log some login auditing informations, and I'm
> using JBoss 4 and Java with compliance level 5.0. It's a very old legacy
> system...
> 
> I've added this lines at my log4j.xml:
> 
> <appender name="AUDITOR"
> class="org.jboss.logging.appender.RollingFileAppender">
>     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
>     
>     
>     
>     
>     <layout class="org.apache.log4j.PatternLayout">
>         
>     </layout>	    
> </appender>
> 
> <category name="com.itautec.siac.controleAcesso" additivity="false">
>     <priority value="INFO"/>
>     <appender-ref ref="AUDITOR"/>
> </category>
> 
> And in my Foo.java class, I've added this field:
> 
> private static final Logger logger = Logger.getLogger(Foo.class);
> 
> When I want to log something (inside my Foo.java class), I just call my
> logger with something like:
> 
> logger.info("any message");
> 
> 
> Well, after that, I start JBoss4, and I can see that Auditor.log file is
> created in my log folder, as it should be, but everything I try to log
> doesn't appear in my Auditor.log file... :-(
> 
> When I start my application in debug mode, I can see that I'm passing
> through several loggers that I've put in my Foo.java class, but it seems
> that log4j is just ignoring these callings and nothing is logged at all...
> 
> Does anyone know what's happening? It seems to be something really simple,
> but I can't figure it out! :-((
> 
> Thanks from now and best regards! :-)
> 

-- 
View this message in context: http://old.nabble.com/Problems-with-log4j-configuration--SOLVED--tp33190553p33196579.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org