[jboss-user] [JBoss Tools] - Re: JBoss Developer Studio 5 - console log output gone with "Run as Java Application" and using org.apache.commons.logging.LogFactory
b.b.
do-not-reply at jboss.com
Fri Aug 24 02:09:12 EDT 2012
b.b. [https://community.jboss.org/people/b.b.] created the discussion
"Re: JBoss Developer Studio 5 - console log output gone with "Run as Java Application" and using org.apache.commons.logging.LogFactory"
To view the discussion, visit: https://community.jboss.org/message/755651#755651
--------------------------------------------------------------
//Here is a Java class to test this.
////////////////////////////////////////////////////////////////
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
public class LoggerTest {
static Log logF = LogFactory.getLog(LoggerTest.class);
static Logger logJ = Logger.getLogger(LoggerTest.class);
public static void main(String[] args) {
System.out.println("LogFactory loggin");
logF.info("LogFactory?");
logF.debug("LogFactory");
logF.error("LogFactory");
System.out.println("LogFactory loggin end");
System.out.println("Logger loggin");
logJ.info("Logger");
logJ.debug("Logger");
logJ.error("Logger");
System.out.println("Logger loggin end");
}
}
////////////////////////////////////////////////////////////////
#Content of the file log4j.properties:
log4j.rootCategory=DEBUG, CONSOLE
# Stdout
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%d{hh:mm:ss.SSS}]%5p - %C.%M:%L - %m %n
// the structure of the project for the test
https://community.jboss.org/servlet/JiveServlet/showImage/2-755651-19289/TestLogging.jpg https://community.jboss.org/servlet/JiveServlet/downloadImage/2-755651-19289/272-128/TestLogging.jpg
My console output is:
LogFactory loggin
LogFactory loggin end
Logger loggin
[07:50:22.099] INFO - LoggerTest.main:25 - Logger
[07:50:22.103]DEBUG - LoggerTest.main:26 - Logger
[07:50:22.104]ERROR - LoggerTest.main:27 - Logger
Logger loggin end
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/755651#755651]
Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120824/651b2f7b/attachment.html
More information about the jboss-user
mailing list