| Author |
Can the path of lo4j properties file be relative to classpath?
|
Vikas Kapoor
Ranch Hand
Joined: Aug 16, 2007
Posts: 1374
|
|
web.xml
log4j.properties
When I give "classpath:resources/log4j.properties" , it takes the actual path and gives file not found exception.
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
|
I don't think you can specify it that way no.
|
Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
|
 |
Vikas Kapoor
Ranch Hand
Joined: Aug 16, 2007
Posts: 1374
|
|
Thanks Martijn. I think the only way is if I use my implementation for that. But it is more practical to be in that way because nowadays in many java technologies it's been implemented in that way for example Spring. I define in this way.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16482
|
|
|
But log4j will look for the log4j.properties file in the classpath anyway, without you having to do anything at all. I don't see any benefit in what you're asking for there, just so you can put the file in a different directory. You don't even need an init-param if you allow log4j to work in the normal way.
|
 |
Vikas Kapoor
Ranch Hand
Joined: Aug 16, 2007
Posts: 1374
|
|
Paul, I tried putting the log4j.properties file into classpath i.e. under classes folder and pass only the file name like,
But it doesn't work. So how do you suggest it?
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
|
You don't need to perform any initialisation at all, it will just 'work out of the box'
|
 |
 |
|
|
subject: Can the path of lo4j properties file be relative to classpath?
|
|
|