« Return to Thread: Problems with log4j configuration [SOLVED]

RE: Problems with log4j configuration

by rhaiger :: Rate this Message:

| View in Thread

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...
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...

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

 « Return to Thread: Problems with log4j configuration [SOLVED]