logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject RE: log4j stops logging at console
Date Tue, 17 May 2005 03:31:32 GMT

The thing that confused me was that it seemed like he was saying that there 
were two physically separate instances of JBoss being started up.  That is, 
each in their own JVM.  If that were the case, then this issue would be a 
bit perplexing.  If it is all, ultimately running under a single JBoss 
instance, then your explanation makes sense.

I wouldn't say that JBoss needs internal rework to get 
application-separated logging working, though.  If the repository selector 
hasn't already been set, it can be set once by any application.  If it has, 
then JBoss already has the concept in mind, and they must provide some sort 
of hook-in to be able to configure the repository selector.

Jake

At 09:38 AM 5/16/2005 -0700, you wrote:
 >JBoss, by current design, only provides for one logging context (ie
 >LoggerRepository).  On top of that, the JBoss log4j.xml also sets up a
 >special CONSOLE appender that maps the System.out and System.err streams.
 >
 >If you do any kind of configuration after JBoss starts up that affects the
 >console appender OR affects loggers that have been defined in the JBoss
 >log4j.xml file, then it will affect the output to the log files.  Especially
 >Console, do not mess with Console.  Also, if your log4j code ever calls
 >LoggerRepository.shutdown() during a redeploy, then logging will be hosed as
 >well.
 >
 >JBoss really needs to provide a better mechanism to allowing web apps and
 >ejb's to do their own logging.
 >
 >Log4j does provide some "layering" of configuration where you can set up
 >your own loggers and appenders as long as they are not references by the
 >first/base configuration file.  Or you can just add your logging stuff to
 >the JBoss log4j.xml file directly.
 >
 >You may also find the following link useful, but I don't know if anyone has
 >gotten to work correctly in JBoss or not.  Seems to me that to be completely
 >efficient, it would need to be supported pretty deep in the JBoss log4j
 >initialization.
 >
 >http://www.qos.ch/logging/sc.jsp
 >
 >-Mark
 >
 >
 >> -----Original Message-----
 >> From: Clandes Tino [mailto:clandestino_bgd@yahoo.co.uk]
 >> Sent: Monday, May 16, 2005 6:51 AM
 >> To: log4j-user@logging.apache.org
 >> Subject: log4j stops logging at console
 >>
 >> Hello all.
 >> I am facing the problem with log4j usage in two
 >> separate applications.
 >> I am using CONSOLE appenders for both of them.
 >> Applications are started separately (in two shell
 >> windows). The first app (App1) is assembled as EAR and
 >> deployed under JBoss (it uses log4j.jar from
 >> JBoss/server/default/lib and initializes log4j through
 >> MBean, where appenders and loggers are configured).
 >>
 >> Here is the method in MBean that configures log4j in
 >> App1:
 >> -------------------------------------------------------
 >> private void initLog4j() throws ConfigurationException
 >> {
 >>     final Properties props = new Properties();
 >>     props.setProperty("log4j.category.com.myapp",
 >> "DEBUG, CONSOLE, FILE");
 >>
 >> props.setProperty("log4j.appender.CONSOLE","org.apache.log4j.ConsoleAppend
 >> er");
 >> props.setProperty("log4j.appender.CONSOLE.layout","org.apache.log4j.Patter
 >> nLayout")
 >>
 >> props.setProperty("log4j.appender.CONSOLE.layout.ConversionPattern","%d{IS
 >> O8601}
 >>  %-5p [%c{1}] [%X{user}]  - %m%n");
 >>
 >> props.setProperty("log4j.appender.FILE","org.apache.log4j.RollingFileAppen
 >> der");
 >>
 >> props.setProperty("log4j.appender.FILE.File",
 >> getConfigurationSetting(LOG_FILE));
 >>
 >> props.setProperty("log4j.appender.FILE.MaxFileSize",
 >> getConfigurationSetting(MAX_FILE_SIZE));
 >>
 >> props.setProperty("log4j.appender.FILE.MaxBackupIndex",
 >> getConfigurationSetting(MAX_BACKUP_FILE));
 >>
 >> props.setProperty("log4j.appender.FILE.layout","org.apache.log4j.PatternLa
 >> yout");
 >>
 >> props.setProperty("log4j.appender.FILE.layout.ConversionPattern","%d{ISO86
 >> 01}
 >>  %-5p [%c{1}] [%X{user} %X{ip} %X{userAgent}] -
 >> %m%n");
 >>
 >>         PropertyConfigurator.configure(props);
 >>      }
 >>
 >> App1 uses A.jar and B.jar from App2 in compilation and
 >> runtime. Both jars are placed in sar archive and
 >> deployed in default/deploy folder under Jboss.
 >>
 >> The other (App2) is RMI Server application deployed
 >> separately (it uses another log4j-1.2.8.jar placed in
 >> its classpath). A.jar and B.jar are in its classpath.
 >> App2 configures log4j by log4j properties file:
 >>
 >> ------------------------------------------------
 >> log4j.category.CONSOLE = , aCONSOLE
 >> log4j.appender.aCONSOLE =
 >> org.apache.log4j.ConsoleAppender
 >> log4j.additivity.CONSOLE=false
 >> log4j.appender.aCONSOLE.ImmediateFlush=true
 >> log4j.appender.aCONSOLE.layout=org.apache.log4j.PatternLayout
 >> --------------------------------------------------
 >>
 >> Both applications are physically on the same machine.
 >> The problem occurs when some class from App1 invokes a
 >> class from B.jar. Then logging disappears from console
 >>  window of App1. No further message in log appears.
 >> However logging into file works OK.
 >>
 >> My question is:
 >> What can cause such behavior?
 >>
 >> Thanx for the hint in advance.
 >> Best regards
 >> Milan
 >>
 >>
 >>
 >>
 >> ___________________________________________________________
 >> How much free photo storage do you get? Store your holiday
 >> snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.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


Mime
View raw message