logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abramson, Rami" <rami.abram...@terayon.com>
Subject RE: logging inside an EJB
Date Sun, 29 Dec 2002 09:43:07 GMT
Here's the story:

1> We use a 3rd party that uses the Weblogic5.1 as an appserver and wraps
it.
2> Each invocation that we do from the client to the appserver runs in the
context of an EJB. The 3rd party's code runs and it calls our appserver code
in the EJB context.
3> We do not have access to the 3rd party's sources and we want to use log4j
to log our code in the appserver.
4> We also want to redirect the 3rd party's outstream to one of log4j debug
modes (they use 'System.out.println'/'System.err.println').
5> Although we cannot interfere with the appserver's code we can create a
main java class that makes some initializtions and launches the 3rd party
appserver.



What we have tried to do is:
a> In our wrapping appserver initialization instantiate an "appserver"
logger that is based on log4j (a simple wrapping logger as explained in "The
Complete log4j Manual").
b> In the wrapping appserver initialization  instantiate a rerooting class
that reroots all the System.out/err  'println()/print()'  to the logger's
"Error" mode.
c> In the context of an EJB - instantiate an "appserver2" logger.
d> Use the "appserver2" logger in other EJBs by calling the
debug()/info()/...  functions.


Result:
In stage <d> we get the exception that was presented in the previous mail.


Questions:
A> Why do we get the exception?
B> Is the general approach OK?
C> Is there an issue of updating an application-server logger during runtime
(using the property file)?  We tried doing it and the appserver got stuck.

	thank you,

	Rami







-----Original Message-----
From: ceki@qos.ch [mailto:ceki@qos.ch]
Sent: Friday, December 27, 2002 11:31 AM
To: Log4J Users List
Subject: RE: logging inside an EJB



It looks like the buf array in java.io.ObjectOutputStream is null. I don't 
see that is possible because the buf array is initialized in 
ObjectOutputStream constructor. However, there is another constructor 
reserved for sub-classes of ObjectOutputStream which does not initialize 
the buffer.

When does the problem occur? Does it occur immediately after launching 
weblogic or after some time?

At 11:07 27.12.2002 +0200, you wrote:
>Windows-2K, JDK1.3-NT, config-file (sorry for the comments- but I paste it
>all it case something is wrong):
>
>
>##############################
>#### General log settings ####
>##############################
>
>#log4j.rootLogger=TRACE#debugLogging.XLevel, dest1, dest2
>#log4j.rootLogger=INFO, dest1, dest2
>log4j.rootLogger=DEBUG, dest1
>#log4j.rootLogger=FATAL, dest1
>
>
>#log4j.debug=true
>
>#log4j.PropertyConfigurator.delay=100
>
>
>#############################################
>#### First appender writes to the CONSOLE ###
>#############################################
>log4j.appender.dest1=org.apache.log4j.ConsoleAppender
>log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
>
>
>log4j.appender.dest1.layout.ConversionPattern=%-6p: %m%n
>#log4j.appender.dest1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
>#log4j.appender.dest1.layout.ConversionPattern=%-4r [%t] %-5p %c %d %x -
>%m%n
>
>### basic line format
>#log4j.appender.dest1.layout.ConversionPattern=%d{MMM-dd HH:mm:ss} %-5p
>%-5C{1}: %m%n
>
>### detailed line format
>#log4j.appender.dest1.layout.ConversionPattern=%d{MMM-dd HH:mm:ss} %-5p
[%t]
>%l: %m%n
>
>
>##########################################
>#### Second appender writes to a FILE ####
>##########################################
>#log4j.appender.dest2=org.apache.log4j.CompositeRollingAppender
>#log4j.appender.dest2.File=${oware.user.root}/logs/log4j/log4jExample.log
>#log4j.appender.dest2.File=${oware.user.root}/logs/log4j/${BASIC_OUTPUT_FIL
E
>_NAME}
>#log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
>
># Control the maximum log file size
>
># Archive log files (one backup file here)
>#log4j.appender.dest2.RollingStyle=3
>#log4j.appender.dest2.CountDirection=-1
>#log4j.appender.dest2.MaxFileSize=1000000
>#log4j.appender.dest2.MaxSizeRollBackups=10
>#log4j.appender.dest2.datePattern='.'yyyy-MM-dd
>
>### basic line format
>#log4j.appender.dest2.layout.ConversionPattern=%d{MMM-dd HH:mm:ss} %-5p
>%C{1}: %m%n
>#log4j.appender.dest2.layout.ConversionPattern=%d{HH:mm:ss} %-3p %C{1}:
%m%n
>
>### detailed line format
>#log4j.appender.dest2.layout.ConversionPattern=%d{MMM-dd HH:mm:ss} %-5p
[%t]
>%l: %m%n
>
>
>
>
>
>         thank you,
>
>         Rami
>
>
>
>
>-----Original Message-----
>From: ceki@qos.ch [mailto:ceki@qos.ch]
>Sent: Friday, December 27, 2002 11:02 AM
>To: Log4J Users List
>Subject: Re: logging inside an EJB
>
>
>
>It would have been helpful to include the config file, to mention the JDK
>version and the OS platform.
>
>At 10:49 27.12.2002 +0200, you wrote:
> >Hello,
> >
> >Trying to log from an EJB of a weblogic app-server I get the following
> >exception.
> >
> >
> >ERROR : java.lang.NullPointerException
> >ERROR :         at
> >java.io.ObjectOutputStream.writeInternal(ObjectOutputStream.java:1368)
> >ERROR :         at
> >java.io.ObjectOutputStream.write(ObjectOutputStream.java:1390)
> >ERROR :         at java.io.PrintStream.write(PrintStream.java:222)
> >ERROR :         at
> >java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:230)
> >ERROR :         at
> >java.io.OutputStreamWriter.flush(OutputStreamWriter.java:244)
> >ERROR :         at
> >org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:49)
> >ERROR :         at
> >org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:306)
> >ERROR :         at
> >org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
> >ERROR :         at
> >org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
> >ERROR :         at
>
>org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(Appen
>d
> >erAttachableImpl.java:57)
> >
> >ERROR :         at
> >org.apache.log4j.Category.callAppenders(Category.java:187)
> >ERROR :         at org.apache.log4j.Category.forcedLog(Category.java:372)
> >ERROR :         at org.apache.log4j.Category.log(Category.java:864)
> >ERROR :         at
> >com.terayon.framework.debugLogging.TrnLogger.debug(TrnLogger.java:92)
> >ERROR :         at
>
>com.terayon.nms.function.discovery.CreateGroup.execute(CreateGroup.java:29)
> >ERROR :         at
> >com.terayon.nms.function.AFunction.executeFunction(AFunction.java:74)
> >ERROR :         at
>
>com.terayon.meta.im.function.runRule(com_terayon_meta_im_function.java:85)
> >ERROR :         at
> >com.terayon.meta.im.function.run(com_terayon_meta_im_function.java:54)
> >ERROR :         at com.dorado.runtime.OWRule.run(Unknown Source)
> >ERROR :         at
> >com.dorado.core.ejb.ruleengine.OWRuleEngine.callEJBRule(Unknown Source)
> >ERROR :         at
>
>com.dorado.core.ejb.ruleengine.OWRuleEngineEOImpl.callEJBRule(OWRuleEngineE
>O
> >Impl.java:275)
> >ERROR :         at
>
>com.dorado.core.ejb.ruleengine.OWRuleEngineEOImpl_WLSkel.invoke(OWRuleEngin
>e
> >EOImpl_WLSkel.java:119)
> >ERROR :         at
>
>weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAd
>a
> >pter.java:347)
> >ERROR :         at
> >weblogic.rmi.extensions.BasicRequestHandler.handleRequest(Unknown Source)
> >ERROR :         at
>
>weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:
>1
> >5)
> >ERROR :         at
>weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> >ERROR : TrnLogger.trnLogger =
> >com.terayon.framework.debugLogging.TrnLogger@1df61d
> >
> >
> >
> >The properties file contains only a ConsoleAppender (have read that
> >file-appeanders cannot be used in EJBs).
> >
> >What can be the matter?
> >
> >         thank you,
> >
> >               Rami A.
> >
> >
> >--
> >To unsubscribe, e-mail:
><mailto:log4j-user-unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail:
><mailto:log4j-user-help@jakarta.apache.org>
>
>--
>Ceki
>
>
>
>--
>To unsubscribe, e-mail:
<mailto:log4j-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
<mailto:log4j-user-help@jakarta.apache.org>
>
>--
>To unsubscribe, e-mail:
<mailto:log4j-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
<mailto:log4j-user-help@jakarta.apache.org>

--
Ceki



--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message