Hi Jake,
I am not using any custom DOMConfigurator class.I am running
my code on the tomcat so I am using code level to set this command line
variable.I am using this code in my Listener class .
String cmd="java -Dlog4j.configuration=file:///C:/kondal/log4j.xml
in.co.netsol.niab.portal.actions.MyContextListener";
//String cmd="cmd.exe /c set";
Runtime runtime = Runtime.getRuntime();
Process process = null;
System.out.println("command is "+cmd);
process = runtime.exec(cmd);
Even if I set that variable in environment Variables manually then also it
is not working.I will try with Custom DOMConfigurator .
Thanks
kondal
On Thu, Feb 26, 2009 at 10:59 PM, Jacob Kjome <[email protected]> wrote:
> On Thu, 26 Feb 2009 21:00:48 +0530
> kondal rao <[email protected]> wrote:
>
>> Thanks for your reply.I am using sample only.just a spelling mistake.
>>
>> I tried this (file:///C:/samplel/log4j.xml) but it is not working.Any
>> ideas
>> please.
>>
>
> You just made the same spelling mistake again.
>
> Also, one critical thing I forgot to mention is that you really need to set
> this as a -D parameter on your java command line. Trying to set it via code
> is pointless because auto-configuration will have already run in the
> LogManager static block. So...
>
> java -Dlog4j.configuration=file:///C:/sample/log4j.xml MyMainClass
>
>
> BTW, do you use a custom DOMConfigurator; "com.foo.DOMConfigurator"? I'm
> guessing you don't actually use a custom DOMConfigurator. If not, I don't
> think you have to set the log4j.configuratorClass property. I think the
> auto-configuration code will look at the suffix (.xml -vs- .properties) to
> determine the configurator type. Haven't looked at that code for a long
> time, so I'm not 100% sure about this. Testing will bear this out. Try it
> without setting the log4j.configuratorClass property. If configuration
> loads fine, you'll know it's not needed.
>
>
> Jake
>
>
>
>>
>>
>> Thanks
>> kondal
>>
>> On Thu, Feb 26, 2009 at 8:42 PM, Jacob Kjome <[email protected]> wrote:
>>
>> On Thu, 26 Feb 2009 14:03:43 +0530
>>> kondal rao <[email protected]> wrote:
>>>
>>> Hi,
>>>>
>>>> I am using the log4j for logging in my webapplication.I am keeping
>>>> the
>>>> log4j.xml file outside of my web application(generally we will keep
>>>> under
>>>> WEB-INF/classes).My problem is my application is not loading the
>>>> log4j.xml.I am using the following code while my context is initializing
>>>> to
>>>> load the log4j.xml in to my class path.
>>>> System.setProperty("log4j.configuration",
>>>> "C:/samplel/log4j.xml"); System.setProperty("log4j.configuratorClass",
>>>> "com.foo.DOMConfigurator"); But it is not working.I am using tomcat5.0.
>>>>
>>>>
>>> Try using a valid URL to your config file...
>>>
>>> file:///C:/samplel/log4j.xml
>>>
>>> BTW, is your directory really named "samplel"? Or is it supposed to be
>>> "sample"?
>>>
>>>
>>> Jake
>>>
>>>
>>>
>>>> Any Ideas Please.
>>>>
>>>>
>>>>
>>>> --
>>>> Regards
>>>> Kondalarao Navuluri
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>> --
>> Regards
>> Kondalarao Navuluri
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Regards
Kondalarao Navuluri