I believe the reason that log4j configuration doesn't thow exceptions is that normally logging isn't the core reason for the program and a problem with logging shouldn't stop the program.
If you look through the API I believe you will find methods to obtain attached appenders so you could verify that way (but then your code would have to know about your config). On 1/18/07, Marcel Gołuński <[EMAIL PROTECTED]> wrote:
Hello. I made a little research before posting here. And i didn't find any interesting answers. ---------------------------------------- Major question: (from log4j wiki's FAQ - not answered (http://wiki.apache.org/logging-log4j/FrequentlyAskedQuestions) ) "How can I get notified of errors during configuration and then handle them? For example, I want to log to a file but the directory does not exist yet. I want to catch that configuration error, create the directory and restart configuration." (from wiki's requested features (http://wiki.apache.org/logging-log4j/Log4jRequestedFeatures) ) "PropertyConfigurator.configure() and doConfigure() methods should return some sort of status to know if the loaded properties are valid." I'm using DOMConfigurator (configureAndWatch) to read a conf file for a jboss webapp (log4j1.2.8, checked 1.2.14 nothing changed). I want to know if the reading was successful. I think that there is no exeption thrown (even if file does not exist, not only on validation errors). my questions: - Is there any way to check if the conf file was read successfully (I may switch to properties configuration if it is supported there) - Is there any way to check on configureAndWatch that file was actually reread and configuration changes were made. (For example to attach some actionPerformer to log4j configureAndWatch which will be triggered when reading occures.) (I suppose no)? ----------------------------------------- Minor questions: NOTE: I know that file appenders throw exeptions so it is easy there. How can i determine that appenders and loggers were instantiated (created)? my idea (not checked but i think working): - logger org.apache.log4j.LogManager method: exist() - appender (after attaching to a logger) org.apache.log4j.Logger (exactly Category super class) methods: isAttached(), getAppender(), getAllAppenders() (and Enumerate for the one im trying to check) Is there any other way (easier, faster) to determine that loggers and appenders were created and attached succesfully? Its a pity that log4j does not support exceptions, but i understand the "performance issue", and think that it is connected with the lack of exceptions. Sorry for my English. Best Wishes, -- Marcel Golunski Horus s.c. http://www.horus.com.pl --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- James Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/