tags:

views:

63

answers:

2

Can I do something along the lines of:

-Djava.util.logging.loglevel=FINE

Obviously that doesn't work, but you get the idea. Is there anything like that? Or am I forced to create a properties file?

A: 

you can configure your code to set the level based on an envrioment variable :

String sLoglevel= System.getenv("LOGLEVEL");  
int ilevel = loglevel.parseInt(sLoglevel);
//set the log level based on retrieved value 
Alon
A: 

You can even pass your log Level as a user defined property.

-DmyProp.logLevel=FINE

In your code:

String logLevel = System.getProperties("myProp.logLevel");

But I have the idea that your are looking for a more "built-in" and automatically handled property, right? AFAIK, it doesn't exist, but maybe I'm wrong.

Laurent K
yeah, i was hoping for something more built-in, but maybe this is the best i can do
Ben McCann