To be honest I didn't found a way to add this line:

-Djava.util.logging.config.file=mylogging.properties

to an Web Dynamic Project that deploys on Tomcat Server. If you know how to
this, pls let me know. In the meantime I found an other solution. I wrote a
static class with this input:

Logger log = Logger.getLogger("myApp");
log.setLevel(Level.ALL);
log.info("initializing - trying to load configuration file ...");

Properties preferences = new Properties();
try {
    FileInputStream configFile = new
FileInputStream("/path/to/app.properties");
    preferences.load(configFile);
    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 myApp");

Now when the application starts, the properties file will be read by Log
Manager and openjpa logs in the configured file. But I have the feeling that
this does not work so good as I hoped. So I swapped back to normal openJpa
Logging mode for openJPA Log. And the other things will be logged by Java.


Now an other question. Is there a possibility to add date and time to the
normal openJPA logging mode, that I configured like that:

<property name="openjpa.Log" value="File=logs/org.apache.openjpa.log,
DefaultLevel=WARN, Runtime=WARN, Tool=WARN, SQL=WARN"/>

I nedd a prefix with date and time for the log messages.

Thank you.




--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Load-logging-properties-of-java-util-logging-for-openJPA-logging-tp7580310p7580387.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to