RE: How to get values from log4j.xml file

2008-08-26 Thread Bender Heri
Logger.getLogger().getAppender( "SERVER_LOG" ); 

> -Original Message-
> From: Reza Razavipour [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 26, 2008 2:30 AM
> To: Log4J Users List
> Subject: How to get values from log4j.xml file
> 
> All,
> 
> I have a log4j.xml file for my application. I have something 
> like the following in the file:
>class="org.jboss.logging.appender.DailyRollingFileAppender">
>class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
>value="${jboss.server.home.dir}/log/server.log"/>
> 
> 
>/appender>
> 
> How can I programmatically get the properties for SERVER_LOG appender?
> 
> Thanks in advance.
> Reza
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to get values from log4j.xml file

2008-08-26 Thread Reza Razavipour
Thanks for the response. When I try it, I get null for Appender. Any
thoughts on why? The code is as follows:

jboss-log4j.xml has










at runtime I have
import org.apache.log4j.Appender;
import org.apache.log4j.Logger;

private static Logger log = Logger.getLogger(MyClass.class);

in the constructor, I have
Appender serverAppender = log.getAppender(""XXX_LOG_FILE");
if (serverAppender != null)
{
String name = serverAppender.getName();
}

serverAppender is always null.

Any thoughts on this?
Thanks
Reza






On Tue, Aug 26, 2008 at 12:25 AM, Bender Heri <[EMAIL PROTECTED]> wrote:
> Logger.getLogger().getAppender( "SERVER_LOG" );
>
>> -Original Message-
>> From: Reza Razavipour [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, August 26, 2008 2:30 AM
>> To: Log4J Users List
>> Subject: How to get values from log4j.xml file
>>
>> All,
>>
>> I have a log4j.xml file for my application. I have something
>> like the following in the file:
>>   > class="org.jboss.logging.appender.DailyRollingFileAppender">
>>   > class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
>>   > value="${jboss.server.home.dir}/log/server.log"/>
>> 
>>
>>/appender>
>>
>> How can I programmatically get the properties for SERVER_LOG appender?
>>
>> Thanks in advance.
>> Reza
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to get values from log4j.xml file

2008-08-26 Thread Curt Arnold


On Aug 26, 2008, at 10:02 AM, Reza Razavipour wrote:


Thanks for the response. When I try it, I get null for Appender. Any
thoughts on why? The code is as follows:

jboss-log4j.xml has










at runtime I have
import org.apache.log4j.Appender;
import org.apache.log4j.Logger;

   private static Logger log = Logger.getLogger(MyClass.class);

in the constructor, I have
   Appender serverAppender = log.getAppender(""XXX_LOG_FILE");
   if (serverAppender != null)
   {
   String name = serverAppender.getName();
   }

serverAppender is always null.

Any thoughts on this?
Thanks
Reza



Logger.getAppender(String) returns the appender that is attached to  
the logger and has that name.  Your appender is named "XXX_LOG_FILE"  
but is not attached to the logger you specified, so it returns null.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to get values from log4j.xml file

2008-08-26 Thread Bender Heri
 If you have not defined explicitely a Logger for MyClass.class you have
to climb up the Logger Hierarchy until you find the Logger which is
really configured in your config file and has the desired appender
attached.
Heri

> -Original Message-
> From: Reza Razavipour [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 26, 2008 5:03 PM
> To: Log4J Users List
> Subject: [SPAM (Keyword Checking)] - Re: How to get values 
> from log4j.xml file - Found word(s) XXX in the Text body
> 
> Thanks for the response. When I try it, I get null for 
> Appender. Any thoughts on why? The code is as follows:
> 
> jboss-log4j.xml has
> 
>class="org.jboss.logging.appender.DailyRollingFileAppender">
>value="${jboss.home.dir}/bin/log/"/>
>   
>   
>   
>value="%d %m%n"/>
>   
>   
> 
> at runtime I have
> import org.apache.log4j.Appender;
> import org.apache.log4j.Logger;
> 
> private static Logger log = Logger.getLogger(MyClass.class);
> 
> in the constructor, I have
> Appender serverAppender = log.getAppender(""XXX_LOG_FILE");
> if (serverAppender != null)
> {
> String name = serverAppender.getName();
> }
> 
> serverAppender is always null.
> 
> Any thoughts on this?
> Thanks
> Reza
> 
> 
> 
> 
> 
> 
> On Tue, Aug 26, 2008 at 12:25 AM, Bender Heri 
> <[EMAIL PROTECTED]> wrote:
> > Logger.getLogger().getAppender( "SERVER_LOG" );
> >
> >> -Original Message-
> >> From: Reza Razavipour [mailto:[EMAIL PROTECTED]
> >> Sent: Tuesday, August 26, 2008 2:30 AM
> >> To: Log4J Users List
> >> Subject: How to get values from log4j.xml file
> >>
> >> All,
> >>
> >> I have a log4j.xml file for my application. I have 
> something like the 
> >> following in the file:
> >>>> class="org.jboss.logging.appender.DailyRollingFileAppender">
> >>>> class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
> >>>> value="${jboss.server.home.dir}/log/server.log"/>
> >> 
> >>
> >>/appender>
> >>
> >> How can I programmatically get the properties for 
> SERVER_LOG appender?
> >>
> >> Thanks in advance.
> >> Reza
> >>
> >> 
> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [SPAM (Keyword Checking)] - JMS Appender Issue - log4j - Found word(s) list error in the Text body

2008-08-26 Thread NehaG

The log4j.properties file is being read by my code. As other appenders are
working fine for me with the same configurations. But the JMS Appender is
giving the problem. The error may lie somewhere else.


Bender Heri wrote:
> 
> This error occurs normally if the config file could not have been found
> at all by log framework. It must be found in classpath.
> Heri
> 
>> -Original Message-
>> From: NehaG [mailto:[EMAIL PROTECTED] 
>> Sent: Tuesday, August 26, 2008 7:06 AM
>> To: log4j-user@logging.apache.org
>> Subject: [SPAM (Keyword Checking)] - JMS Appender Issue - 
>> log4j - Found word(s) list error in the Text body
>> 
>> 
>> Hi All
>> I am trying to use JMS Appender of log4j in my application 
>> using log4j.properties file - but its not running.
>> I am using the jboss-4.2.2.GA Server. The error I am getting 
>> is as follows:
>> 
>> log4j:WARN No appenders could be found for 
>> logger(org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory).
>> log4j:WARN Please initialize the log4j system properly.
>> 
>> The code does not run ahead of this warning and it stucks there.
>> 
>> I searched a lot but am not able to find the solution.
>> The log4j.properties file configuration which I am using is 
>> as follows:
>> 
>> log4j.rootLogger=DEBUG, jmsapp
>> log4j.appender.jmsapp=org.apache.log4j.net.JMSAppender
>> log4j.appender.jmsapp.InitialContextFactoryName=org.jnp.interf
>> aces.NamingContextFactory
>> log4j.appender.jmsapp.ProviderURL=jnp://localhost:1099
>> log4j.appender.jmsapp.TopicBindingName=topic/testTopic
>> log4j.appender.jmsapp.TopicConnectionFactoryBindingName=Connec
>> tionFactory
>> 
>> If someone knows about the problem - please let me know. Any 
>> help is a welcome.
>> 
>> Thanks
>> Neha
>> --
>> View this message in context: 
>> http://www.nabble.com/JMS-Appender-Issue---log4j-tp19155840p19
>> 155840.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/RE%3A--SPAM-%28Keyword-Checking%29JMS-Appender-Issue---log4j---Found-word%28s%29-list-error-in-the-Text-body-tp19157140p19174942.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [SPAM (Keyword Checking)] - JMS Appender Issue - log4j - Found word(s) list error in the Text body

2008-08-26 Thread Curt Arnold


On Aug 27, 2008, at 12:38 AM, NehaG wrote:



The log4j.properties file is being read by my code. As other  
appenders are
working fine for me with the same configurations. But the JMS  
Appender is

giving the problem. The error may lie somewhere else.



Add a log4j.debug=true to the file and see if that produces any  
additional diagnostic.  I'm guessing that you may have an exception  
during the construction of JMSAppender, possibly a NoClassDefError due  
to required class not being on the classpath.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [SPAM (Keyword Checking)] - JMS Appender Issue - log4j - Found word(s) list error in the Text body

2008-08-26 Thread NehaG

I did log4j.debug=true
Now the earlier error has gone out - now the execution is stuck at the below
point:

log4j: Parsing for [root] with value=[DEBUG, JMPApp].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "JMPApp".
log4j: Setting property [initialContextFactoryName] to
[org.jnp.interfaces.NamingContextFactory].
log4j: Setting property [providerURL] to [jnp://localhost:1099].
log4j: Setting property [topicBindingName] to [topic/testTopic].
log4j: Setting property [topicConnectionFactoryBindingName] to
[ConnectionFactory].
log4j: Getting initial context.
log4j: Looking up [ConnectionFactory]
log4j:WARN No appenders could be found for logger
(org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory).
log4j:WARN Please initialize the log4j system properly.
log4j: About to create TopicConnection.

I am calling the RootLogger from my code and invoking the error method from
my code.





Curt Arnold-3 wrote:
> 
> 
> On Aug 27, 2008, at 12:38 AM, NehaG wrote:
> 
>>
>> The log4j.properties file is being read by my code. As other  
>> appenders are
>> working fine for me with the same configurations. But the JMS  
>> Appender is
>> giving the problem. The error may lie somewhere else.
>>
> 
> Add a log4j.debug=true to the file and see if that produces any  
> additional diagnostic.  I'm guessing that you may have an exception  
> during the construction of JMSAppender, possibly a NoClassDefError due  
> to required class not being on the classpath.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/RE%3A--SPAM-%28Keyword-Checking%29JMS-Appender-Issue---log4j---Found-word%28s%29-list-error-in-the-Text-body-tp19157140p19175346.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]