Re: toggling NSlog for framework
Re: toggling NSlog for framework
- Subject: Re: toggling NSlog for framework
- From: Chuck Hill <email@hidden>
- Date: Fri, 28 May 2004 09:56:38 -0700
Have you looked at log4j? http://logging.apache.org/log4j/docs/
It is very flexible and seems to be the preferred Java logging
solution. I've used it and find that works well. There are also some
simple classes around that can redirect existing NLogs to log4j.
I use this along with a method like this:
http://www.wodev.com/cgi-bin/WebObjects/WODev.woa/wa/Main?
wikiPage=TurnSQLLoggingOnAndOff
To perform selective logging.
However, this won't prevent SQL for entities in the framework from
being logged in other code that uses them. To do that you'll need to
dig a lot deeper into EOF and replace its logging code.
Chuck
On May 26, 2004, at 10:05 AM, Arturo Perez wrote:
Hi Chuck,
Here's my situation. I have my main WOApplication which does a fair
amount of SQL. I also link in a framework (homegrown) that does a lot
of SQL on its own.
At this point, I'm happy with the framework and I trust that it's
doing the correct thing. When I want to debug the SQL for the
application I turn on adaptor logging with the command line option.
Now my log is filled with stuff from the framework.
I took a glance at the NSLog logging groups stuff. But it looked like
a lot of work to get what I want; essentially I would like lots of
debug groups. I guess I'm used to syslog and other logging systems
that where the logging statement is of the form
log(<FACILITY>, <LEVEL>, "msg");
but NSLog requires
if (NSLog.debugLoggingAllowedFor...(FACILITY) &&
NSLog.debugLoggingAllowedFor...(LEVEL))
NSLog.out(msg);
which is a headache bordering on migraine. I realize that there will
be a performance issue if you don't do it NSLog's way. That limits
the possibilities quite a bit. No macros in Java makes it that much
more annoying. Running all the code through M4 would be pesky.
I guess I'm asking for a best implementation approach to logging. On
its own, NSLog is a fine point of departure. But it's not sufficient.
I have, in the distant past, created logging facilities that enabled
debugging of complex applications just by reviewing a trace file. I
can't see being successful to the same degree at that with NSLog.
Maybe I'm just a whinging git :-)
-arturo
Chuck Hill wrote:
Hi Arturo,
I'm not clear on what you are trying to achieve. You want to not log
for a certain sub-set of entities? Would it be easier to turn
logging on and off around the pieces of code that you *do* want
logging from?
Chuck
On May 25, 2004, at 10:09 AM, Arturo Pirez wrote:
Hi all,
I have a framework with its own EOModel. I would like to disable
EOAdaptorDebugging on "entry" to this framework and reenable on
"exit". Any suggestions for how to do that?
TIA
--arturo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.