-
1. Re: java.util.logging to Log4j mapping
peterj May 22, 2008 11:05 AM (in response to alexandrem)I think that this is because the Java logger outputs to stderr, and log4j captures anything written to stderr and logs it using ERROR. I am not sure if you can configure Java logging to write to stdout instead (in which case I think the output shows up as INFO)
-
2. Re: java.util.logging to Log4j mapping
nsimoes May 23, 2008 8:16 AM (in response to alexandrem)why not use the method info instead of log?
-
3. Re: java.util.logging to Log4j mapping
alexandrem May 23, 2008 9:34 AM (in response to alexandrem)Using .info() method produces the exact same output, I get messages directed to STDERR instead of STDOUT.
Thanks for the help,
Alexandre Mendonca -
4. Re: java.util.logging to Log4j mapping
jaikiran May 24, 2008 2:23 AM (in response to alexandrem)Do you have a configuration file of your own for the java.util logger? If not, it will pick up the logging.properties file from lib folder of the JRE home. The logging.properties by default configures the handlers to
handlers= java.util.logging.ConsoleHandler
As Peter already mentioned and as per the javadoc of ConsoleHandler
http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/ConsoleHandler.html, this handler logs the messages to System.err. Here's the relevant part from the javadoc:This Handler publishes log records to System.err.
-
5. Re: java.util.logging to Log4j mapping
henk53 Nov 24, 2008 12:24 PM (in response to alexandrem)I realize this is basically a JDK matter and not necessarily a Jboss issue, but still, what would be the easiest and most portable way to solve this in Jboss?
I.e. I would like to deploy a .war to a client's JVM, without having to change either their Jboss installation or their JVM installation. How would I go about doing that? -
6. Re: java.util.logging to Log4j mapping
jaikiran Nov 25, 2008 11:36 AM (in response to alexandrem)I haven't given it a try, but how about packaging a logging.properties in your war file and configuring a file appender/handler (whatever the right term is) instead of the console handler?
-
7. Re: java.util.logging to Log4j mapping
dmlloyd May 27, 2010 10:55 AM (in response to alexandrem)Alexandre Mendonça wrote:
Hi all,
I'm having an issue when using java.util.logging.Logger, the output gets into ERROR level and into STDERR making it look like an error message. [...]This is because we don't directly support JDK logging in this version of AS. If you're feeling adventurous, you could try pulling in the jboss-logbridge project, and installing its handler into your JDK logging root logger, and it should port over log messages for you.
It should be clear how this works from the source code. You can check out jboss-logbridge from this link: http://anonsvn.jboss.org/repos/common/jboss-logbridge/tags/1.0.0.GA/
It is also in Maven here: https://repository.jboss.org/nexus/content/repositories/releases/org/jboss/logbridge/jboss-logbridge/1.0.0.GA/jboss-logbridge-1.0.0.GA.jar
-
8. Re: java.util.logging to Log4j mapping
kargi Oct 21, 2010 5:13 AM (in response to dmlloyd)David Lloyd wrote:
This is because we don't directly support JDK logging in this version of AS. If you're feeling adventurous, you could try pulling in the jboss-logbridge project, and installing its handler into your JDK logging root logger, and it should port over log messages for you.
It should be clear how this works from the source code. You can check out jboss-logbridge from this link: http://anonsvn.jboss.org/repos/common/jboss-logbridge/tags/1.0.0.GA/
It is also in Maven here: https://repository.jboss.org/nexus/content/repositories/releases/org/jboss/logbridge/jboss-logbridge/1.0.0.GA/jboss-logbridge-1.0.0.GA.jar
I have tried unsuccessfully to be adventurous with the logbridge-project:)
Can you give any more hints how to configure jboss to use the LogBridgeHandler instead of the ConsoleHandler? Or have I misunderstood the whole thing?
Thanks
-
9. Re: java.util.logging to Log4j mapping
henk53 Oct 21, 2010 2:38 PM (in response to dmlloyd)David Lloyd wrote:
This is because we don't directly support JDK logging in this version of AS.
Will JBoss AS 6 support this directly? I know that JDK logging was late to the game in the world of loggers, but it has been around for some time now and many people seem to be using it.