You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Matt Sgarlata <sg...@users.sourceforge.net> on 2004/12/27 20:26:36 UTC
Re: commons-logging auto-detection WAS: [logging] Enterprise
Common Logging... dare we say 2.0?
Ceki Gülcü wrote:
> At 03:05 AM 12/27/2004, Charles Daniels wrote:
>
>> If I understand the JCL discovery mechanism correctly, it actually
>> should work just fine in the scenario you describe above. For it to
>> work, you would not set the org.apache.commons.logging.LogFactory system
>> property, because, as you pointed out, system properties are JVM-wide.
>> Rather, for individual applications to use distinct underlying logging
>> implementations, you can simply place a commons-logging.properties file
>> in each application context (in WEB-INF/classes), setting the
>> org.apache.commons.logging.LogFactory property as appropriate in each
>> distinct commons-logging.properties file. Since these properties files
>> will be loaded via distinct context class loaders, each application can
>> use distinct logging implementations.
>
>
> Good point. This will require some understanding by the user about the
> classloader delegation mechanism used by the app server, which varies
> from vendor to vendor or even from version to version of an app server
> by the same vendor. Nevertheless, I stand corrected.
>
>
Couldn't this be refined even further by incorporating a change to JCL I
proposed earlier? Here's a copy of my original post:
I have an idea... All logging implementations for Java configure logging
by package, right? What if we allow component developers to include
their own commons-logging.properties that's not at the root of the
source tree? For example, if Morph suddenly decided it was very
important to have certain messages logged, I just drop a
commons-logging.properties in net.sf.morph that specifies the logging
settings for net.sf.morph and all subpackages (e.g. which log factory to
use, whether my messages *must* be heard, etc). If JCL detects such a
file it ensure the component that the logging it specifies is happening.
If an application developer, assembler or deployer decides later that
Morph really isn't as important as I'd like, then they just delete the
commons-logging.properties or put their own version in the
WEB-INF/classes directory. (Forgive me if this is a great show of my
ignorance of classloading, but I think this is at least how things work
for Tomcat).
Searching for a file like this on the classpath would certainly have
performance implications. However, search cost is incurred only on
startup and there is precedent (see below), so it can't be too bad. It's
certainly worth a try.
http://java.sun.com/j2se/1.4.2/docs/api/java/beans/PropertyEditorManager.html
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by Dennis Lundberg <de...@mdh.se>.
robert burrell donkin wrote:
>
> On 7 Jan 2005, at 08:43, Paul Libbrecht wrote:
>
>>
>> Le 6 janv. 05, à 22:46, robert burrell donkin a écrit :
>>
>>> given the extra layer proposed, the discovery/configuration mechanism
>>> that should be employed for the JVM would be set by a system property
>>
>>
>> Careful to offer one alternative to system properties... (maybe like a
>> LoggingProperties class which does not load any other class): System
>> properties are often not readable and not writable in some
>> environments and commons-logging has been quite much sandbox-friendly
>> thus far...
>
>
> i haven't been able to think of any general mechanism for JVM level
> configuration that would work well in strongly sandboxed environments.
> it's critical that the base API classes are very portable and small. i'd
> be glad to hear of any suitable alternatives...
>
> at the moment, if the system property cannot be read, it will be
> ignored. this behaviour would be retained. it would then default to
> trying to load LogFactory (for backwards compatibility) and use that for
> discovery (thus defaulting to the current behaviour). if LogFactory
> cannot be loaded, it would fall back on a very simple logging
> implementation (which would probably print ERROR and FATAL to System.err).
>
> IIRC in these kinds of environments the JCL currently has many issues.
> i've proposed that the general solution for heavily secured environments
> (such as untrusted applets) would be to dope the application (using byte
> code engineering) so that all references to JCL are rewired to a logger
> appropriate to that environment (one which would, for example, just
> print ERROR and FATAL level messages to System.err). i believe that this
> would allow JCL to be used successfully in a much wider variety of
> environments.
We use JCL in both untrusted and signed applets. There used to be issues
with the sandbox before, but with the release of 1.0.4 these issues are
gone.
--
Dennis Lundberg
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 7 Jan 2005, at 08:43, Paul Libbrecht wrote:
>
> Le 6 janv. 05, à 22:46, robert burrell donkin a écrit :
>
>> given the extra layer proposed, the discovery/configuration mechanism
>> that should be employed for the JVM would be set by a system property
>
> Careful to offer one alternative to system properties... (maybe like a
> LoggingProperties class which does not load any other class): System
> properties are often not readable and not writable in some
> environments and commons-logging has been quite much sandbox-friendly
> thus far...
i haven't been able to think of any general mechanism for JVM level
configuration that would work well in strongly sandboxed environments.
it's critical that the base API classes are very portable and small.
i'd be glad to hear of any suitable alternatives...
at the moment, if the system property cannot be read, it will be
ignored. this behaviour would be retained. it would then default to
trying to load LogFactory (for backwards compatibility) and use that
for discovery (thus defaulting to the current behaviour). if LogFactory
cannot be loaded, it would fall back on a very simple logging
implementation (which would probably print ERROR and FATAL to
System.err).
IIRC in these kinds of environments the JCL currently has many issues.
i've proposed that the general solution for heavily secured
environments (such as untrusted applets) would be to dope the
application (using byte code engineering) so that all references to JCL
are rewired to a logger appropriate to that environment (one which
would, for example, just print ERROR and FATAL level messages to
System.err). i believe that this would allow JCL to be used
successfully in a much wider variety of environments.
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by Paul Libbrecht <pa...@activemath.org>.
Le 6 janv. 05, à 22:46, robert burrell donkin a écrit :
> given the extra layer proposed, the discovery/configuration mechanism
> that should be employed for the JVM would be set by a system property
Careful to offer one alternative to system properties... (maybe like a
LoggingProperties class which does not load any other class): System
properties are often not readable and not writable in some environments
and commons-logging has been quite much sandbox-friendly thus far...
paul
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 4 Jan 2005, at 19:15, Paul Libbrecht wrote:
> Le 4 janv. 05, à 19:42, Richard Sitze a écrit :
>> I think that what you are asking for is a way to bind a LogFactory
>> instance to a particular ClassLoader, perhaps immediately following
>> the
>> construction of the ClassLoader instance:
>
> Well, if I was in control of the application, that would be true but I
> am not.
> (more or less).
> I still insist on something like a method static
> LogFactory.getLogFactoryOfThread() which would use a previous call to
> LogFactory.setLogFactoryOfThread(LogFactory).
i'd see that this kind of thing is exactly what an additional
configuration layer could enable. i'd be very, very reluctant to see
this added into JCL as it is at the present since it would added
complexity which would only be useful for a limited set of
environments. in others it may be positively harmful (for example,
server environments where threads are pooled).
given the extra layer proposed, the discovery/configuration mechanism
that should be employed for the JVM would be set by a system property.
each pluggable implementation would be capable of supporting whatever
extra configuration it needed. so, ThreadLogFactory (for example) might
discovery the right implementation to use based on the value of a
thread local variable and could support setters (as described above).
when a brick was used by an application running in a suitable
environment, the application would just need to ensure that the
appropriate system property was set and then the LogFactory discovery
would use the thread local mechanism.
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by Paul Libbrecht <pa...@activemath.org>.
Le 4 janv. 05, à 19:42, Richard Sitze a écrit :
> I think that what you are asking for is a way to bind a LogFactory
> instance to a particular ClassLoader, perhaps immediately following the
> construction of the ClassLoader instance:
Well, if I was in control of the application, that would be true but I
am not.
(more or less).
I still insist on something like a method static
LogFactory.getLogFactoryOfThread() which would use a previous call to
LogFactory.setLogFactoryOfThread(LogFactory).
paul
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by Richard Sitze <rs...@us.ibm.com>.
Paul Libbrecht <pa...@activemath.org> wrote on 01/04/2005 03:26:00 AM:
> Hi,
>
> This may be related but I was fighting recently with embedding Jelly
> within jEdit which, of course, has its own class-loading mechanism
> because of plugins.
> I simply did not manage to have jelly:log messages directed to my
> console but it may be not so important.
>
> I realized that one thing that would have strongly advantaged me is to
> be able to "pre-load" the current logging factory (or even a "context
> logger", of which all child-loggers that would be created would appear)
> set as a thread-local static instance.
> This way, as long as we understand classloading times (which is really
> not that hard), it is possible for plugins that use other things that
> use logging to actually influence this logging.
I think that what you are asking for is a way to bind a LogFactory
instance to a particular ClassLoader, perhaps immediately following the
construction of the ClassLoader instance:
setFactory(ClassLoader, LogFactory);
Thoughts:
a. Under the auspices of the 'one config' policy, such an API would throw
an exception if an attempt were made to bind a LogFactory instance to a
ClassLoader which has a different LogFactory instance already bound to it.
b. Though this is a simple method to implement [it's cacheFactory made
public], keep it simple: we've talked about looking for a pluggable
discovery mech, with a minimalistic default discovery. The default
shouldn't exhibit this behavior, perhaps commons-discovery (JCD) can take
on this new idea.
Under this scheme, you would establish the presence of JCD in your JVM,
JCL LogFactory.getFactory [static method] would locate JCD and use it
instead of it's default internal mechanism. Your application code would
create a new ClassLoader, and use JCD.bind(ClassLoader, Object) to do the
binding.
>
> I would choose this to have priority to others, at least if a certain
> system property is set.
>
> paul
>
>
> Le 2 janv. 05, à 22:50, robert burrell donkin a écrit :
> > On 28 Dec 2004, at 00:40, Matt Sgarlata wrote:
> >> I think often JCL will be used as you describe, but not always.
> >>
> >> For example, let's say I am developing a component that monitors
> >> database activity and monitors usage statistics (this is a
> >> hypothetical example). The main purpose of this component is to log
> >> messages to be processed later by a human. I use JCL and put a
> >> commons-logging.properties in my org.dbmonitor package that says "use
> >> Log4J and display INFO and higher messages".
> >>
> >> This component may be deployed in many different environments. Here
> >> are two examples:
> >> 1) Standalone on a server. In this case, the default settings
> >> specified at the component level should be used.
> >> 2) As a component of another application. In this case, the overall
> >> application specifies logging properties that overwrite those in the
> >> component. To do this, the application specifies a
> >> commons-logging.properties in the default package, which overwrites
> >> the properties specified at the component level. In this example,
> >> the application chooses it only wants WARN and higher messages and
> >> that it wants the messages rendered with JDK 1.4 logging.
> >>
> >> My point is that one overall configuration of logging for the entire
> >> JVM may be too restrictive. I think we could benefit from multiple
> >> JCL configurations, each targeted at different parts of a system.
> >
> > i think that the idea we're going forward with is that there needs
> > only to be one discovery configuration for the whole of the JVM (not
> > one logging implementation). when a request for a log is received, the
> > pluggable discovery mechanism chosen by the configuration determines
> > how the bridging implementation is assigned. at the present, the
> > discovery mechanism is not configurable and is implemented in
> > LogFactory. hopefully later, it would be possible to choose to use the
> > current mechanism or use a system property to replace it with another
> > completely different one.
> >
> > FWIW i think that the package level discovery mechanism would be
> > powerful in some use cases and would support such a discovery
> > mechanism but only as pluggable implementation, not as part of the
> > default discovery mechanism (the classloader issues concern me
> > greatly).
> >
> > - robert
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
*******************************************
Richard A. Sitze
IBM WebSphere WebServices Development
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by Paul Libbrecht <pa...@activemath.org>.
Hi,
This may be related but I was fighting recently with embedding Jelly
within jEdit which, of course, has its own class-loading mechanism
because of plugins.
I simply did not manage to have jelly:log messages directed to my
console but it may be not so important.
I realized that one thing that would have strongly advantaged me is to
be able to "pre-load" the current logging factory (or even a "context
logger", of which all child-loggers that would be created would appear)
set as a thread-local static instance.
This way, as long as we understand classloading times (which is really
not that hard), it is possible for plugins that use other things that
use logging to actually influence this logging.
I would choose this to have priority to others, at least if a certain
system property is set.
paul
Le 2 janv. 05, à 22:50, robert burrell donkin a écrit :
> On 28 Dec 2004, at 00:40, Matt Sgarlata wrote:
>> I think often JCL will be used as you describe, but not always.
>>
>> For example, let's say I am developing a component that monitors
>> database activity and monitors usage statistics (this is a
>> hypothetical example). The main purpose of this component is to log
>> messages to be processed later by a human. I use JCL and put a
>> commons-logging.properties in my org.dbmonitor package that says "use
>> Log4J and display INFO and higher messages".
>>
>> This component may be deployed in many different environments. Here
>> are two examples:
>> 1) Standalone on a server. In this case, the default settings
>> specified at the component level should be used.
>> 2) As a component of another application. In this case, the overall
>> application specifies logging properties that overwrite those in the
>> component. To do this, the application specifies a
>> commons-logging.properties in the default package, which overwrites
>> the properties specified at the component level. In this example,
>> the application chooses it only wants WARN and higher messages and
>> that it wants the messages rendered with JDK 1.4 logging.
>>
>> My point is that one overall configuration of logging for the entire
>> JVM may be too restrictive. I think we could benefit from multiple
>> JCL configurations, each targeted at different parts of a system.
>
> i think that the idea we're going forward with is that there needs
> only to be one discovery configuration for the whole of the JVM (not
> one logging implementation). when a request for a log is received, the
> pluggable discovery mechanism chosen by the configuration determines
> how the bridging implementation is assigned. at the present, the
> discovery mechanism is not configurable and is implemented in
> LogFactory. hopefully later, it would be possible to choose to use the
> current mechanism or use a system property to replace it with another
> completely different one.
>
> FWIW i think that the package level discovery mechanism would be
> powerful in some use cases and would support such a discovery
> mechanism but only as pluggable implementation, not as part of the
> default discovery mechanism (the classloader issues concern me
> greatly).
>
> - robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 28 Dec 2004, at 00:40, Matt Sgarlata wrote:
> I think often JCL will be used as you describe, but not always.
>
> For example, let's say I am developing a component that monitors
> database activity and monitors usage statistics (this is a
> hypothetical example). The main purpose of this component is to log
> messages to be processed later by a human. I use JCL and put a
> commons-logging.properties in my org.dbmonitor package that says "use
> Log4J and display INFO and higher messages".
>
> This component may be deployed in many different environments. Here
> are two examples:
> 1) Standalone on a server. In this case, the default settings
> specified at the component level should be used.
> 2) As a component of another application. In this case, the overall
> application specifies logging properties that overwrite those in the
> component. To do this, the application specifies a
> commons-logging.properties in the default package, which overwrites
> the properties specified at the component level. In this example, the
> application chooses it only wants WARN and higher messages and that it
> wants the messages rendered with JDK 1.4 logging.
>
> My point is that one overall configuration of logging for the entire
> JVM may be too restrictive. I think we could benefit from multiple
> JCL configurations, each targeted at different parts of a system.
i think that the idea we're going forward with is that there needs only
to be one discovery configuration for the whole of the JVM (not one
logging implementation). when a request for a log is received, the
pluggable discovery mechanism chosen by the configuration determines
how the bridging implementation is assigned. at the present, the
discovery mechanism is not configurable and is implemented in
LogFactory. hopefully later, it would be possible to choose to use the
current mechanism or use a system property to replace it with another
completely different one.
FWIW i think that the package level discovery mechanism would be
powerful in some use cases and would support such a discovery mechanism
but only as pluggable implementation, not as part of the default
discovery mechanism (the classloader issues concern me greatly).
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection WAS: [logging] Enterprise
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Matt Sgarlata <sg...@users.sourceforge.net> writes:
>I think often JCL will be used as you describe, but not always.
>For example, let's say I am developing a component that monitors
>database activity and monitors usage statistics (this is a hypothetical
>example). The main purpose of this component is to log messages to be
>processed later by a human. I use JCL and put a
>commons-logging.properties in my org.dbmonitor package that says "use
>Log4J and display INFO and higher messages".
>This component may be deployed in many different environments. Here are
>two examples:
>1) Standalone on a server. In this case, the default settings specified
>at the component level should be used.
In this case, your standalone app should integrate the org.dbmonitor
component with a small runtime and a JCL config file.
>2) As a component of another application. In this case, the overall
>application specifies logging properties that overwrite those in the
>component. To do this, the application specifies a
>commons-logging.properties in the default package, which overwrites the
>properties specified at the component level. In this example, the
>application chooses it only wants WARN and higher messages and that it
>wants the messages rendered with JDK 1.4 logging.
In this case, your application, which integrates the org.dbmonitor
component should configure logging for it.
IMHO, it is not possible to find an "one size fits all" solution which
allows a component to be integrated seamlessly and to be used
standalone.
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire
Linux, Java, perl, Solaris -- Consulting, Training, Development
What is more important to you...
[ ] Product Security
or [ ] Quality of Sales and Marketing Support
-- actual question from a Microsoft customer survey
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection WAS: [logging] Enterprise Common
Logging... dare we say 2.0?
Posted by Richard Sitze <rs...@us.ibm.com>.
news <ne...@sea.gmane.org> wrote on 12/27/2004 06:40:16 PM:
> I think often JCL will be used as you describe, but not always.
"Not always" is of less concern. Matt, the PRIMARY focus of JCL is as
Ceki described. There are no if/ands/buts about it. If you choose to use
it in any other fashion, you are certainly welcome too.
However, from a design standpoint, this one point is critical. We make
decisions that direct the development of JCL on this point.
> For example, let's say I am developing a component that monitors
> database activity and monitors usage statistics (this is a hypothetical
> example). The main purpose of this component is to log messages to be
> processed later by a human. I use JCL and put a
> commons-logging.properties in my org.dbmonitor package that says "use
> Log4J and display INFO and higher messages".
>
> This component may be deployed in many different environments. Here are
> two examples:
> 1) Standalone on a server. In this case, the default settings specified
> at the component level should be used.
> 2) As a component of another application. In this case, the overall
> application specifies logging properties that overwrite those in the
> component. To do this, the application specifies a
> commons-logging.properties in the default package, which overwrites the
> properties specified at the component level. In this example, the
> application chooses it only wants WARN and higher messages and that it
> wants the messages rendered with JDK 1.4 logging.
>
> My point is that one overall configuration of logging for the entire JVM
> may be too restrictive. I think we could benefit from multiple JCL
> configurations, each targeted at different parts of a system.
>
> Matt
>
> Ceki Gülcü wrote:
> >
> > Matt,
> >
> > JCL exists mainly for the purpose of libraries wishing to *integrate*
> > with the logging API chosen by the user by deferring the selection of
> > the logging impl to runtime. The author of library "net.sf.morph"
> > probably does *not* wish to impose any logging related property on the
> > end-user. Consequently, it does not make sense to have package
> > specific properties at the JCL level. Would you agree?
> >
> >
> > At 08:26 PM 12/27/2004, Matt Sgarlata wrote:
> >
> >> Couldn't this be refined even further by incorporating a change to
JCL
> >> I proposed earlier? Here's a copy of my original post:
> >>
> >> I have an idea... All logging implementations for Java configure
> >> logging by package, right? What if we allow component developers to
> >> include their own commons-logging.properties that's not at the root
of
> >> the source tree? For example, if Morph suddenly decided it was very
> >> important to have certain messages logged, I just drop a
> >> commons-logging.properties in net.sf.morph that specifies the logging
> >> settings for net.sf.morph and all subpackages (e.g. which log factory
> >> to use, whether my messages *must* be heard, etc). If JCL detects
> >> such a file it ensure the component that the logging it specifies is
> >> happening. If an application developer, assembler or deployer
decides
> >> later that Morph really isn't as important as I'd like, then they
just
> >> delete the commons-logging.properties or put their own version in the
> >> WEB-INF/classes directory. (Forgive me if this is a great show of my
> >> ignorance of classloading, but I think this is at least how things
> >> work for Tomcat).
> >>
> >> Searching for a file like this on the classpath would certainly have
> >> performance implications. However, search cost is incurred only on
> >> startup and there is precedent (see below), so it can't be too bad.
> >> It's certainly worth a try.
> >>
> >> http://java.sun.com/j2se/1.4.
> 2/docs/api/java/beans/PropertyEditorManager.html
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
*******************************************
Richard A. Sitze
IBM WebSphere WebServices Development
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection WAS: [logging] Enterprise
Common Logging... dare we say 2.0?
Posted by Matt Sgarlata <sg...@users.sourceforge.net>.
I think often JCL will be used as you describe, but not always.
For example, let's say I am developing a component that monitors
database activity and monitors usage statistics (this is a hypothetical
example). The main purpose of this component is to log messages to be
processed later by a human. I use JCL and put a
commons-logging.properties in my org.dbmonitor package that says "use
Log4J and display INFO and higher messages".
This component may be deployed in many different environments. Here are
two examples:
1) Standalone on a server. In this case, the default settings specified
at the component level should be used.
2) As a component of another application. In this case, the overall
application specifies logging properties that overwrite those in the
component. To do this, the application specifies a
commons-logging.properties in the default package, which overwrites the
properties specified at the component level. In this example, the
application chooses it only wants WARN and higher messages and that it
wants the messages rendered with JDK 1.4 logging.
My point is that one overall configuration of logging for the entire JVM
may be too restrictive. I think we could benefit from multiple JCL
configurations, each targeted at different parts of a system.
Matt
Ceki Gülcü wrote:
>
> Matt,
>
> JCL exists mainly for the purpose of libraries wishing to *integrate*
> with the logging API chosen by the user by deferring the selection of
> the logging impl to runtime. The author of library "net.sf.morph"
> probably does *not* wish to impose any logging related property on the
> end-user. Consequently, it does not make sense to have package
> specific properties at the JCL level. Would you agree?
>
>
> At 08:26 PM 12/27/2004, Matt Sgarlata wrote:
>
>> Couldn't this be refined even further by incorporating a change to JCL
>> I proposed earlier? Here's a copy of my original post:
>>
>> I have an idea... All logging implementations for Java configure
>> logging by package, right? What if we allow component developers to
>> include their own commons-logging.properties that's not at the root of
>> the source tree? For example, if Morph suddenly decided it was very
>> important to have certain messages logged, I just drop a
>> commons-logging.properties in net.sf.morph that specifies the logging
>> settings for net.sf.morph and all subpackages (e.g. which log factory
>> to use, whether my messages *must* be heard, etc). If JCL detects
>> such a file it ensure the component that the logging it specifies is
>> happening. If an application developer, assembler or deployer decides
>> later that Morph really isn't as important as I'd like, then they just
>> delete the commons-logging.properties or put their own version in the
>> WEB-INF/classes directory. (Forgive me if this is a great show of my
>> ignorance of classloading, but I think this is at least how things
>> work for Tomcat).
>>
>> Searching for a file like this on the classpath would certainly have
>> performance implications. However, search cost is incurred only on
>> startup and there is precedent (see below), so it can't be too bad.
>> It's certainly worth a try.
>>
>> http://java.sun.com/j2se/1.4.2/docs/api/java/beans/PropertyEditorManager.html
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [logging] Enterprise Common Logging... dare we say 2.0?
Posted by Ceki Gülcü <ce...@qos.ch>.
Richard,
The commons-logging-<impl>.jar approach you suggested earlier will throw an
exception if <impl> is not available which should be perfectly fine because
if the user explicitly puts commons-logging-<impl>.jar in her classpath,
then it means that she wants <impl> around.
I quite like it.
>It lends it's self well to this, but it's not sufficient. The requirement
>is for this behavior to be exhibited by JCL, for example when Log4j is
>configuted, but not available on the classpath.
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [logging] Enterprise Common Logging... dare we say 2.0?
Posted by Richard Sitze <rs...@us.ibm.com>.
Ceki Gülcü <ce...@qos.ch> wrote on 12/27/2004 05:31:23 PM:
>
> At 2004-12-16 16:51:31, Richard Sitze wrote:
>
> > I do not advocate a fail-on-no-config or fail-on-ambiguous-config.
> >
> > I advocate a *warn* or *error* on either, using the simple default
logger.
> > The warning will be visible on the console, which suffices for my
> > immediate concerns. How that warning/error (in general) is managed
is up
> > to the application environment.
>
> Log4j 1.3 can use itself for its own logging. So, when appender A
> fails, it can report errors using appender B. Appender B could alert the
> system admin if that is the desired behavior.
>
> The same goes for configuration errors which are also accessible
> programmatically. For example,
>
>
> Configurator c = new SomeLog4jConfigurator();
> c.configure("some file");
> List el = c.getErrorList();
> if(el.size > 0) {
> if(analyzeErrors(el)) {
> // errors during logging configuration
> throw new IllegalStateException("Can't proceed withour logging");
> }
> }
>
> boolean analyzeErrors(List el) {
> // custom analysis of the errors go here
> return true/false;
> }
>
> It seems to me that log4j already fulfills Richard's requirements wrt
> logging errors and logging configuration.
It lends it's self well to this, but it's not sufficient. The requirement
is for this behavior to be exhibited by JCL, for example when Log4j is
configuted, but not available on the classpath.
>
>
> --
> Ceki Gülcü
>
> The complete log4j manual: http://www.qos.ch/log4j/
*******************************************
Richard A. Sitze
IBM WebSphere WebServices Development
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [logging] Enterprise Common Logging... dare we say 2.0?
Posted by Ceki Gülcü <ce...@qos.ch>.
At 2004-12-16 16:51:31, Richard Sitze wrote:
> I do not advocate a fail-on-no-config or fail-on-ambiguous-config.
>
> I advocate a *warn* or *error* on either, using the simple default logger.
> The warning will be visible on the console, which suffices for my
> immediate concerns. How that warning/error (in general) is managed is up
> to the application environment.
Log4j 1.3 can use itself for its own logging. So, when appender A
fails, it can report errors using appender B. Appender B could alert the
system admin if that is the desired behavior.
The same goes for configuration errors which are also accessible
programmatically. For example,
Configurator c = new SomeLog4jConfigurator();
c.configure("some file");
List el = c.getErrorList();
if(el.size > 0) {
if(analyzeErrors(el)) {
// errors during logging configuration
throw new IllegalStateException("Can't proceed withour logging");
}
}
boolean analyzeErrors(List el) {
// custom analysis of the errors go here
return true/false;
}
It seems to me that log4j already fulfills Richard's requirements wrt
logging errors and logging configuration.
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: commons-logging auto-detection WAS: [logging] Enterprise
Common Logging... dare we say 2.0?
Posted by Ceki Gülcü <ce...@qos.ch>.
Matt,
JCL exists mainly for the purpose of libraries wishing to *integrate*
with the logging API chosen by the user by deferring the selection of
the logging impl to runtime. The author of library "net.sf.morph"
probably does *not* wish to impose any logging related property on the
end-user. Consequently, it does not make sense to have package
specific properties at the JCL level. Would you agree?
At 08:26 PM 12/27/2004, Matt Sgarlata wrote:
>Couldn't this be refined even further by incorporating a change to JCL I
>proposed earlier? Here's a copy of my original post:
>
>I have an idea... All logging implementations for Java configure logging
>by package, right? What if we allow component developers to include their
>own commons-logging.properties that's not at the root of the source
>tree? For example, if Morph suddenly decided it was very important to
>have certain messages logged, I just drop a commons-logging.properties in
>net.sf.morph that specifies the logging settings for net.sf.morph and all
>subpackages (e.g. which log factory to use, whether my messages *must* be
>heard, etc). If JCL detects such a file it ensure the component that the
>logging it specifies is happening. If an application developer, assembler
>or deployer decides later that Morph really isn't as important as I'd
>like, then they just delete the commons-logging.properties or put their
>own version in the WEB-INF/classes directory. (Forgive me if this is a
>great show of my ignorance of classloading, but I think this is at least
>how things work for Tomcat).
>
>Searching for a file like this on the classpath would certainly have
>performance implications. However, search cost is incurred only on
>startup and there is precedent (see below), so it can't be too bad. It's
>certainly worth a try.
>
>http://java.sun.com/j2se/1.4.2/docs/api/java/beans/PropertyEditorManager.html
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org