WEB-INF/classes.
The logger is loaded by the class loader used for all your other classes. The fact that you have a WEB-INF implies that you're building a "Web" project and you mention websphere 7.5.4. However, you don't usually have a static main function in a web project, you'd be using servlets instead. So maybe we need more information about your setup to help you to a solution.
By the way, you don't usually specify the loading of the properties file. You just specify getLogger and the logger code will find the properties file; provided you have it in the right spot. Loggers are usually specied as static; you don't want the machine to build a new one for every instance of your class. Specify the class as the target of the logger; make it Logger.getLogger(MyClass.class). Then in your properties file, you specify the logging level for the class or package.
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of mtodd@xxxxxxxxxxxx
Sent: Monday, March 07, 2011 2:20 AM
To: java400-l@xxxxxxxxxxxx
Subject: util.logging properties file when using Rational wesphere
I am using IBM Rational Application developer for webspere 7.5.4.
Where do I specify in the Rational IDE the logging properties file ?
I thought it should be located under the WEB-INF file.
But when I run the following code-
public static void main(String[] args) {
Logger log = Logger.getLogger("MyLogger1");
log.setLevel(Level.ALL);
log.info("initializing - trying to load configuration file ...");
try {
FileInputStream configFile = new FileInputStream ("logging.properties");
LogManager.getLogManager().readConfiguration(configFile);
} catch (IOException ex)
{
System.out.println("WARNING: Could not open configuration file");
System.out.println("WARNING: Logging not configured (console output only)");
}
log.info("starting MyLogger1");
}
I get the - System.out.println("WARNING: Could not open configuration file"); displayed.
Help greatly appreciated.
***********************************************************************************
CONFIDENTIALITY / DISCLAIMER NOTICE
This communication contains information which is confidential and may also be privileged.
It is for the exclusive use of the recipient(s). If you are not the intended recipient(s) please note that any distribution, copying or use of this communication or the information in it is strictly prohibited.
Any views or opinions presented are solely those of the author and do not necessarily represent those of Costco Wholesale UK Ltd. If you have received this communication in error please notify us by e-mailing the author or by telephoning (01923 213113) and then delete the communication and any copies of it.
This communication is from Costco Wholesale UK Ltd whose registered office is at UK Home Office, Hartspring Lane, Watford WD25 8JS, England.
***********************************************************************************
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.