opensubscriber
   Find in this group all groups
 
Unknown more information…

l : log4j-user@logging.apache.org 11 September 2009 • 10:10PM -0400

Re: Log4J log statements not working with RMI
by Jacob Kjome

REPLY TO AUTHOR
 
REPLY TO GROUP




Logging configuration is stored in a Logger Repository (one by default, though
more may exist if using a Logger Repository Selector) in a given JVM. 
Separate JVMs cannot share a common Logger Repository in the stock Log4j and
nothing has been written to achieve such a thing, to my knowledge.  As such,
loggers defined in a serialized object executed in a separate JVM have zero
knowledge of the configuration in the source JVM.

One way around this is to define a custom Log4j configuration in the remote
JVM that appends to a socket, JMS, a database, a file on a NAS mount, or other
such means to get the logging back to you.  There are also services out there
that allow for centralized and consolidated log viewing.  If you search the
list, you'll find some announcements by various individuals (not necessarily
endorsed by the Log4j team) about such services.

Hope that points you in the right direction.

Jake

On Thu, 10 Sep 2009 23:06:17 -0700 (PDT)
  ShivaVarma <shiva.varma@gmai...> wrote:
>
> Hi Jacob.
>  You have got the problem I am facing. Yes, the logger is used in an object
> being sent remotely so that the logger.log("something") statement doesn't
> actually get called in the current VM, but in a remote one!.
>  With this setup, can anything be done to redirect the logs from the other
> VM to the same file
>
> Thanks a lot
>
>
> Jacob Kjome wrote:
>>
>> 1.  Does anything log to the simple_stdout appender?  Have you tried
>> another
>> one that does get logged to, such as stdout?
>>
>> 2.  How is your logger defined in SupplyChainAdaptor?  Are you positive
>> about
>> the logger name?  Might it not be named after the fully qualified class
>> name
>> as your are expecting?
>>
>> 3.  What exactly do you mean "Logs from SupplyChainAdaptor attached to
>> RMID do
>> no get logged"?  Specifically, I't's not clear to me what the "attached to
>> RMID" part means?  Please explain.  Might it make a difference how the
>> logger
>> is used?  That is, is it used in an object being sent remotely so that the
>> logger.log("something") statement doesn't actually get called in the
>> current
>> VM, but in a remote one?  That would explain your lack of logging.
>>
>>
>> Jake
>>
>>
>> On Wed, 9 Sep 2009 22:40:44 -0700 (PDT)
>>   ShivaVarma <shiva.varma@gmai...> wrote:
>>>
>>> 1. Yes I have manually configured Log4j to pick up log.properties
>>>
>>> 2. Here is the complete log.properties file for reference
>>> log4j.rootLogger=DEBUG, defaultAppender
>>> DefaultPriority=DEBUG
>>> StackDEBUGThreshold=DEBUG
>>>
>>> ################ APPENDERS #####################################
>>> log4j.appender.defaultAppender=org.apache.log4j.RollingFileAppender
>>> log4j.appender.defaultAppender.layout=org.apache.log4j.PatternLayout
>>> log4j.appender.defaultAppender.layout.ConversionPattern=%c{2}::%d - %m%n
>>> log4j.appender.defaultAppender.File=${log4j.logfile}
>>> log4j.appender.defaultAppender.Append=false
>>> log4j.appender.defaultAppender.MaxFileSize=10000KB
>>> log4j.appender.defaultAppender.MaxBackupIndex=5
>>> ################################################################
>>> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>>> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>>> log4j.appender.stdout.layout.ConversionPattern=%c{1} - %m%n
>>> ################################################################
>>> log4j.appender.simple_stdout=org.apache.log4j.ConsoleAppender
>>> log4j.appender.simple_stdout.layout=org.apache.log4j.PatternLayout
>>> log4j.appender.simple_stdout.layout.ConversionPattern=%m%n
>>> ################################################################
>>>
>>> ########### Manipulate the TEST log outputs #####################
>>> log4j.logger.com.r2.test.TMTESTApplicationManager=DEBUG,simple_stdout
>>> log4j.logger.com.r2.test.AdaptorManager=DEBUG,stdout
>>> log4j.logger.com.r2.test.AdapterManagerBase=DEBUG,stdout
>>> log4j.logger.com.r2.test.SimpleXMLParser=DEBUG,stdout
>>> log4j.logger.com.r2.test.AdaptorInterfaceFactory=DEBUG,stdout
>>> log4j.logger.com.r2.test.AdapterManagerBase=DEBUG,stdout
>>> log4j.logger.com.r2.test.SupplyChainAdaptor=DEBUG,simple_stdout
>>>
>>> ######### Filter unwanted logistics API log messages
>>> log4j.logger.com.r2.logistics=DEBUG
>>> log4j.logger.com.r2.logistics.util.propertyarray=DEBUG
>>> log4j.logger.com.r2.odsdb=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.JDBCUtil=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.StatementUtil=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.StatementUtil2=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.BeanWriter2=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.BeanPopulator=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.ResultSetAccessorObject=DEBUG
>>> log4j.logger.com.r2.logistics.util.xmlimport.DataSetImpl=DEBUG
>>> log4j.logger.com.r2.logistics.util.xmlimport.XMLDataSetParser=DEBUG
>>> log4j.logger.com.r2.logistics.util.xmlimport.TagTypeParserMap=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.dataimport.EntityTransformer=ERROR
>>> log4j.logger.com.r2.logistics.util.jdbc.dataimport.ForeignKeyLookupTableXMLImporter=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.dataimport.ForeignKeyResolver=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.metadata.MetaDataUtil=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.metadata.ForeignKeyDefinition=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.metadata.TableDefinitionCatalog=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.dataimport.EntityMappingXMLImporter=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.dataimport.Importer=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.dataimport.DataInserter=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.dataimport.DataInserterBatch=DEBUG
>>> log4j.logger.com.r2.logistics.util.jdbc.oracle.OracleHelper=DEBUG
>>> log4j.logger.com.r2.logistics.util.ExceptionHandlerCollection=DEBUG
>>> log4j.logger.com.r2.logistics.util.ExceptionHandlerCounter=DEBUG
>>> log4j.logger.com.r2.logistics.util.thread.ThreadQueue=DEBUG
>>> log4j.logger.com.r2.logistics.util.ReflectionHelper=DEBUG
>>>
>>> ############# Filter unwanted CIS API log messages
>>> ########################333
>>> log4j.logger.com.r2.cis.util.logger.outputmessage=WARN
>>> log4j.logger.com.r2.cis.util.launcher=WARN
>>> log4j.logger.com.r2.cis.xml=WARN
>>> log4j.logger.com.r2.cis.util=WARN
>>> log4j.logger.com.r2.cis.util.DateUtil=WARN
>>> log4j.logger.com.r2.cis.util.FileUtil=WARN
>>> log4j.logger.com.r2.cis=WARN
>>>
>>>
>>> To point out the problem being faced
>>> log4j.logger.com.r2.test.AdapterManagerBase=DEBUG,stdout  >> Logs from
>>> AdaptorManagerBase get logged
>>> log4j.logger.com.r2.test.SupplyChainAdaptor=DEBUG,simple_stdout >> Logs
>>> from
>>> SupplyChainAdaptor attached to RMID do no get logged.
>>>
>>>
>>>
>>> Jacob Kjome wrote:
>>>>
>>>> Two things...
>>>>
>>>> 1.  You say you use "log.properties".  That won't get picked up
>>>> automatically
>>>> by Log4j.  It must be named "log4j.properties".  So, unless you are
>>>> manually
>>>> configuring Log4j at startup prior to invoking your RMI framework, then
>>>> Log4j
>>>> will remain unconfigured.
>>>>
>>>> 2.  You haven't provided any logger configuration, only appender
>>>> configuration.  Assuming your configuration file is actually getting
>>>> used,
>>>> try
>>>> defining the root logger at the DEBUG level until you determine logging
>>>> is
>>>> actually being performed, at which point you can change it to something
>>>> more
>>>> strict like WARN....
>>>>
>>>> log4j.rootLogger=DEBUG, myAppender, myOtherAppender
>>>>
>>>>
>>>> Jake
>>>>
>>>>
>>>> On Wed, 9 Sep 2009 05:11:52 -0700 (PDT)
>>>>   ShivaVarma <shiva.varma@gmai...> wrote:
>>>>>
>>>>> To briefly sum up our configuration, we have a set of 20 java classes,
>>>>> grouped into 4 groups of 5 classes each.
>>>>>
>>>>> Each group is registered with RMID, therefore there are 4 groups
>>>>> attached
>>>>> with the RMID, we call them as four RMI instances. The 4 RMI instances
>>>>> run
>>>>> parallely, thereby making the system faster.
>>>>>
>>>>> The RMI instances are invoked during startup, and we have a manager
>>>>> java
>>>>> instance, that spawns and attaches the groups to RMID and invokes the
>>>>> classes on the groups
>>>>>
>>>>> The problem being faced is that all the logs in the manager java
>>>>> instance
>>>>> get logged to file/stdout, but the logs in the 20 java classes do not
>>>>> logged, either to file or stdout.
>>>>>
>>>>> The log.properties appender section looks like this
>>>>>
>>>>> ################ APPENDERS #####################################
>>>>> log4j.appender.defaultAppender=org.apache.log4j.RollingFileAppender
>>>>> log4j.appender.defaultAppender.layout=org.apache.log4j.PatternLayout
>>>>> log4j.appender.defaultAppender.layout.ConversionPattern=%c{2}::%d -
>>>>> %m%n
>>>>> log4j.appender.defaultAppender.File=${log4j.logfile}
>>>>> log4j.appender.defaultAppender.Append=false
>>>>> log4j.appender.defaultAppender.MaxFileSize=10000KB
>>>>> log4j.appender.defaultAppender.MaxBackupIndex=5
>>>>> ################################################################
>>>>> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>>>>> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>>>>> log4j.appender.stdout.layout.ConversionPattern=%c{1} - %m%n
>>>>> ################################################################
>>>>> log4j.appender.simple_stdout=org.apache.log4j.ConsoleAppender
>>>>> log4j.appender.simple_stdout.layout=org.apache.log4j.PatternLayout
>>>>> log4j.appender.simple_stdout.layout.ConversionPattern=%m%n
>>>>> ################################################################
>>>>>
>>>>> Like Jacob, has suggested this could be a configuration problem, could
>>>>> you
>>>>> folks further help me understand/debug the problem
>>>>>
>>>>>
>>>>>
>>>>> Jacob Kjome wrote:
>>>>>>
>>>>>> What are the logger names and what is the configuration being used? 
>>>>>> Keep
>>>>>> in
>>>>>> mind, this is essentially *always* a configuration issue, not some new
>>>>>> discovery of a flaw in Log4j.
>>>>>>
>>>>>> Then again, are your logger statements occurring remotely?  In that
>>>>>> case,
>>>>>> they
>>>>>> would not log locally, but on the remote server where you made the
>>>>>> remote
>>>>>> call
>>>>>> to.  Is that the confusion here?
>>>>>>
>>>>>> BTW, log4j-dev is not the appropriate list.  I'm moving this over to
>>>>>> the
>>>>>> user
>>>>>> list.
>>>>>>
>>>>>> Jake
>>>>>>
>>>>>>
>>>>>> On Tue, 8 Sep 2009 04:09:15 -0700 (PDT)
>>>>>>   ShivaVarma <shiva.varma@gmai...> wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>  My RMI framework, spawns multiple classes, containing log4J log
>>>>>>> statements, however, none of these log statements get logged. Log4j
>>>>>>> statements outside of the RMI framework however get redirected to the
>>>>>>> file
>>>>>>> in the log.properties
>>>>>>>  Has anyone come across such similar situations, if so can you
>>>>>>> suggest
>>>>>>> me
>>>>>>> what else needs to be done, or if this is a known problem
>>>>>>>
>>>>>>> Thanks
>>>>>>> Shiva
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>http://www.nabble.com/Log4J-log-statements-not-working-with-RMI-tp25344089p25344089.html
>>>>>>> Sent from the Log4j - Dev mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logg...
>>>>>>>For additional commands, e-mail: log4j-dev-help@logg...
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logg...
>>>>>> For additional commands, e-mail: log4j-user-help@logg...
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>http://www.nabble.com/Re%3A-Log4J-log-statements-not-working-with-RMI-tp25350605p25363676.html
>>>>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logg...
>>>>>For additional commands, e-mail: log4j-user-help@logg...
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logg...
>>>> For additional commands, e-mail: log4j-user-help@logg...
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>>http://www.nabble.com/Re%3A-Log4J-log-statements-not-working-with-RMI-tp25350605p25377596.html
>>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logg...
>>>For additional commands, e-mail: log4j-user-help@logg...
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logg...
>> For additional commands, e-mail: log4j-user-help@logg...
>>
>>
>>
>
> --
> View this message in context:
>http://www.nabble.com/Re%3A-Log4J-log-statements-not-working-with-RMI-tp25350605p25395556.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logg...
>For additional commands, e-mail: log4j-user-help@logg...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logg...
For additional commands, e-mail: log4j-user-help@logg...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.