Re: Logging nightmare
Jürgen Lorenz Simon <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Travis,
thank you for the reply.
On 19.07.2006, at 21:26, Travis Cripps wrote:
> Juergen,
>
> Hi. I may not understand your problem, but it sounds like you want
> to turn on rule tracing in a Project Wonder app.
Yes. But its not the first time I'm trying to do so. The problem is
not so much the individual
properties, although as a consequence of lack of documentation, it
took a while to figure
out. The other thing is this: its very unintuitive that you should
have a file in your home
directory called WebObjects.properties that determines everything.
What if you are dealing
with multiple apps at the same time and want different setups for these?
Also, ERXProperties resolves some property files at a time, where
WebObjects.properties has
already been read and used, although it does claim to read and use it
LAST. If I take the
WebObjects.properties file and put its contents in my application's
Resource/Properties file,
then remove the WebObjects.properties file from my home directory, I
would expect to find
the behaviour unchanged. Instead its broken.
Somehow the application's Property file gets mostly ignored.
ERXProperties claims it finds
it, but somehow the things in there are not applied.
The rest of the problem is probably down to the fact that I don't
find the time to properly get
down to log4j and its way of setting up things.
Altogether this results in a formidable nightmare of (for me) erratic
behaviour and half hour
reads of source and trial-and-error to change small things, like
switching rule tracing on.
All in all less than satisfactory.
> You should have a WebObjects.properties file in your home
> directory. You'll put configuration directives in that file.
>
> Here's mine:
>
>
> ##
> # Log4j Properties
> ##
>
> # Set root logger level to INFO and name its appender "stdout".
> log4j.rootLogger = INFO, stdout
>
> # stdout is set to be a ConsoleAppender, which outputs to System.out.
> log4j.appender.stdout = org.apache.log4j.ConsoleAppender
>
> # stdout uses PatternLayout.
> log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern = %-5p [%t] %d
> {HH:MM:ss} (%c{2}:%L) %x - %m%n
> # Note that %F, %L, %C, %M, and %I are fairly slow and shouldn't be
> used in performance intensive logging
>
> log4j.logger = INFO
>
> log4j.logger.er.extensions = INFO
> log4j.logger.er.d2w = INFO
>
>
> ##
> # WebObjects Properties
> ##
>
> #EOAdaptorDebugEnabled = true
> #WODirectConnectEnabled = false
> D2WTraceRuleFiringEnabled = false
>
>
> ##
> # Project Wonder Properties
> ##
>
> er.javamail.adminEmail = [email protected]
>
> #Bridge logging set to DEBUG
> log4j.logger.er.extensions.ERXNSLogLog4jBridge=DEBUG
Bridge logging. Intuitively that would make me believe that all NSLog
output is now displayed.
Is that correct?
> # Enhanced D2W rule tracing:
> # First set this one to DEBUG
> log4j.logger.er.directtoweb.rules.ERD2WTraceRuleFiringEnabled=DEBUG
>
> # Then add or modify these setting to DEBUG the ones you want to trace
> #log4j.logger.er.directtoweb.rules.componentName=DEBUG
> #log4j.logger.er.directtoweb.rules.customComponentName=DEBUG
I find that project wonder's rule tracing stops altogether unless I
set the following property:
log4j.logger.er.directtoweb = DEBUG.
> You can see that the first part sets up log4j and configures
> several properties of its logging. I don't believe you can turn
> off log4j and still get the rule tracing from PW. You probably
> would still get Apple's rule tracing, though it's not as helpful as
> the PW stuff.
I have not been able to do just that. Switch log4j off and just get
the old rule tracing. It might
not be as helpful as PW's extensive log, but its brief and allows me
to spot problems a lot
quicker most of the time. I'd like to be able to ask for more help
from PW's logging if I need to.
Not being flooded with info ab initio.
> So, you can turn off logging altogether by setting the property:
> log4j.logger = OFF
Aha. The OFF setting is news to me.
> Or you can switch off logging to more specific points like:
>
> log4j.logger.er.extensions = OFF
> log4j.logger.er.d2w = INFO
>
> or even
>
> log4j.logger.er = OFF
>
> Since log4j works as a heirarchy, that should do it for you if you
> don't have any other more specific rules defined. More specific
> rules override the parent rule.
Understood.
> That's pretty much it. Oh, but to get the useful rule tracing from
> PW, you'll want to uncomment some or all of the last 3 lines of my
> config.
> Travis
Thanks a lot, Travis.
J.L.Simon