I need to use the xml version. Also, please read my reply to the previous response I got. I think it applies.
Again, I need a way to change the values for each new client connection (servlet thread). I don't think reloading the properties for each thread is the way to go (although this seems to be the only solution that might work at this point - if I don't use the xml config). thanks for the help, any other ideas? osubb Maarten Bosteels wrote: > > When you use a log4j.properties file instead of log4j.xml > you can use > http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html#configure(java.util.Properties) > > 1) load the log4j.properties file in a Properties object > 2) add all custom properties to the Properties object > 3) call PropertyConfigurator.configure(props) > > I have no idea if something similar can be done with the DOMConfigurator. > You could search the ml archive, this question has come up more than once. > > Maarten > > On Thu, Feb 14, 2008 at 12:23 AM, osubb <[EMAIL PROTECTED]> wrote: > >> >> I am pretty new to log4j and have a question that should be easy. I am >> using >> log4j in a web (java servlets) environment. >> >> 1) How do I pass in variables? I have an app that uses the JDBCAppender >> and would like to pass in the connection values. Is there an easy way to >> do >> this? These values could be different for each client that access the >> Servlet(s). Is there a pattern for this type of scenario? >> >> At this point, I have to hardcode the URL, user, and password values in >> the >> log4j.xml file. I tried using MDC, but this seems to work in the >> "ConversionPattern" param for log files and the "sql" param name for the >> JDBCAppender. It does not work for the "URL", "user", and "password" >> param >> values (does not change to MDC value). >> >> Any help would be appreciated, >> osubb >> -- >> View this message in context: >> http://www.nabble.com/dynamic-variables-parameters-tp15470530p15470530.html >> Sent from the Log4j - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/dynamic-variables-parameters-tp15470530p15481257.html Sent from the Log4j - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
