Re: setting a log file per core with slf4

2008-12-17 Thread Erik Hatcher
MDC looks like the way to go. Thanks for that info, David. Erik On Dec 17, 2008, at 3:13 PM, Smiley, David W. wrote: You bet it does; that's the point! Under the covers, I believe it's simply a thread-local hashmap. Nothing is stored in the loggers the code is using. We just need

Re: setting a log file per core with slf4

2008-12-17 Thread Smiley, David W.
You bet it does; that's the point! Under the covers, I believe it's simply a thread-local hashmap. Nothing is stored in the loggers the code is using. We just need to be careful to remove the variable from MDC when we're done. ~ David On 12/17/08 3:09 PM, "Ryan McKinley" wrote: but does t

Re: setting a log file per core with slf4

2008-12-17 Thread Ryan McKinley
but does this work in a multi-threaded environment? if multiple requests are coming in on multiple threads, would it still be accurate? Perhaps that depends on the underlying implementation? adding the core to the MDC within a RequestHandler context seems reasonable and minimally invasive.

Re: setting a log file per core with slf4

2008-12-17 Thread Erik Hatcher
On Dec 17, 2008, at 2:17 PM, Erik Hatcher wrote: We get the Logger everytime we use it with something like: Logger log = LoggerFactory.getLogger(classname+":"+core.getName() ); but with a dot separator and the core in front, since the logging configuration treats dots as hierarchical logging

Re: setting a log file per core with slf4

2008-12-17 Thread Smiley, David W.
I propose that MDC or NDC be used instead. I prefer MDC. I've written some server-side multi-threaded code where each Thread would run a job and I wanted the job name in the logs. http://www.slf4j.org/api/org/slf4j/MDC.html At some early point when Solr receives a request, you simply store a

Re: setting a log file per core with slf4

2008-12-17 Thread Erik Hatcher
On Dec 17, 2008, at 12:24 PM, Ryan McKinley wrote: I'm not sure I understand... are you suggesting that rather then configuring our logger like this: static Logger log = LoggerFactory.getLogger(SolrCore.class); We get the Logger everytime we use it with something like: Logger log = LoggerFact

Re: setting a log file per core with slf4

2008-12-17 Thread Noble Paul നോബിള്‍ नोब्ळ्
On Wed, Dec 17, 2008 at 10:54 PM, Ryan McKinley wrote: > I'm not sure I understand... > > are you suggesting that rather then configuring our logger like this: > static Logger log = LoggerFactory.getLogger(SolrCore.class); > > We get the Logger everytime we use it with something like: > Logger l

Re: setting a log file per core with slf4

2008-12-17 Thread Ryan McKinley
I'm not sure I understand... are you suggesting that rather then configuring our logger like this: static Logger log = LoggerFactory.getLogger(SolrCore.class); We get the Logger everytime we use it with something like: Logger log = LoggerFactory.getLogger(classname+":"+core.getName() ); That

Re: setting a log file per core with slf4

2008-12-17 Thread Ryan McKinley
at the root of the issue is that logging uses a static logger: static Logger log = LoggerFactory.getLogger(SolrCore.class); i don't know of any minimally invasive way to get get around this... On Dec 17, 2008, at 10:22 AM, Marc Sturlese wrote: I am thinking in doing a hack to specify the lo

Re: setting a log file per core with slf4

2008-12-17 Thread Erik Hatcher
Can't we log with the core as part of the context of the logger, rather than just the classname? This would give you core logging granularity just by config, rather than scraping. Yes? Erik On Dec 17, 2008, at 9:47 AM, Ryan McKinley wrote: As is, the log classes are statically bou

Re: setting a log file per core with slf4

2008-12-17 Thread Marc Sturlese
I am thinking in doing a hack to specify the log path of the solr cores in solr.xml. Would like to do something like: ... Any advice about how should I start? Thanks in advance ryantxu wrote: > > As is, the log classes are statically bound to the class,

Re: setting a log file per core with slf4

2008-12-17 Thread Ryan McKinley
As is, the log classes are statically bound to the class, so they are configured for the entire VM context. Off hand i can't think of any good work around either. The only thing to note is that most core specific log messages include the core name as a prefix: [core0] ... ryan On Dec 1