views:

45

answers:

1

I'm unable to append messages from my application to the JBoss console. The following are the changes that I made to the jboss-log4j.xml configuration file:

<category name="com.tricubes">        
  <priority value="INFO"/>
  <appender-ref ref="CONSOLE"/>
</category>

Here is my code:

public class OneToOneValidation2 {

private static final Logger logger = Logger.getLogger("com.tricubes");

public boolean validate(byte[] fpImage, byte[] fpTemplate, String desc, String ticket) {
    ...
        logger.info("BES INFO: SOCKET MSG SENT " + intToByteArray(x));            

    ...
    return b;
}

}

What am I missing?

TIA!

Edited:

The console appender. Also is the default appender used by JBoss.

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
  <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
  <param name="Target" value="System.out"/>
  <param name="Threshold" value="INFO"/>

  <layout class="org.apache.log4j.PatternLayout">
     <!-- The default pattern: Date Priority [Category] Message\n -->
     <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
  </layout>

I have tried with both org.jboss.logging.Logger and org.apache.log4j.Logger;

A: 

Category is deprecated (use Logger), and Priority is not recommended (use Level). So your config block should be:

<logger name="com.tricubes">        
    <level value="INFO"/>
    <appender-ref ref="CONSOLE"/>
</logger>

Also, what is your CONSOLE appender defined as? If its not pointing at the JBoss console, it wont log there.

Dur4ndal
Random Joe
Are you getting any errors when trying to instantiate OnlyOnceErrorHandler? If so, you need to add jboss commons dependency.
Dur4ndal
Nope, I didn't get any errors at all.. it was just silently ignoring my configurations.
Random Joe