There hasn't be a clear simple statement of what your problem is, therefore the responses have been all over the map.

Your initial posting was:

On Jun 27, 2005, at 11:11 AM, Schuweiler, Joel J. wrote:

Is there a way to use the category chunk in the xml config files to "filter" which appender to use or am I better off making a custom filter which checks the category? I have tested and read that the StringMatchFilter only matches against the message.

Yes, mapping the logger hierarchy to appenders is the one of significant functions of the configuration file. You can use a fragment like:

On Jun 27, 2005, at 1:12 PM, James Stauffer wrote:
  <logger name="Webapps">
    <appender-ref ref="WebAppender"/>
  </logger>
  <logger name="Desktopapps">
    <appender-ref ref="DesktopAppender"/>
  </logger>
  <logger name="Janitorapps">
    <appender-ref ref="JanitorAppender"/>
  </logger>

which would cause all messages in the "Webapps" logger and all descendent loggers ( for example, "Webapps.WidgetSizer.FooBar") to be handled by the WebAppender appender, etc.

Though technically possible, there has not be any demand for a logger based Filter (that is, post message construction handling), since logger based decisions are much more efficiently handled before creating a LoggingEvent. StringMatchFilter has its use, but usually as a fine filtering step after decisions based on logger and level have screened out most of the potential messages. Your request is asking for a "filename based grep" when the right thing to use is "ls".


On Jun 27, 2005, at 1:23 PM, Schuweiler, Joel J. wrote:
This doesn't work for me I presume because the logger name would be what is to the right of the . And I want to look at what is to the left.

Either you didn't understand the response or your are being obstinate. The logger name is like a file path is read from left to right which the most significant aspect to the left. It might be technically possible to have a file system where file names would implemented with the most significant aspect to the right (aka hello.c/hello_world/joel/home/") but you aren't going to have any luck convincing OS writers to implement the scheme. However, displaying a path right to left might be appropriate in Arabic for example, but that would just be a formatting convention. Within applications it would still be encoded left to right.


On Jun 27, 2005, at 2:05 PM, Schuweiler, Joel J. wrote:
I would do something like

static Logger logger = Logger.getLogger("joel.SecondLogger");


This would be appropriate if "joel" was your most significant key to the message.


However if I want to do this it appears I need to make a custom filter and rename it to joel_SecondLogger (_ could be any char but .). This also leaves me with having to modify the log4j jar's that come with for ex. Jboss.

By changing a "." to a "_", you are disabling the ability to route the message based on the elements of the path in the logger name. It would be like rename a file /joel/SecondLogger/foo.c to joel_SecondLogger_foo.c. It significantly reduces the ability of the file system tools to categorize your information.


On Jun 27, 2005, at 2:18 PM, Schuweiler, Joel J. wrote:
If I use a dot it strips off the left side in the logging event

The LoggingEvent will always have the full logger name. Some layout elements allow you to suppress formatting parts of the logger name. For example, a "%c{2}" will display the right two elements of the logger name and %10c would display only the rightmost 10 characters, however that just affects the formatting of the logger name.


On Jun 27, 2005, at 2:29 PM, Schuweiler, Joel J. wrote:
Ok for a lack of a good universal drawing tool I'm going to do dreaded ascii


Applications on a cluster <-> serialized log event <-> socket <-> internet <-> socket server <-> unserialized log event

On the socket server I'm looking for an easy way to tell who sent the log event. Is there an easy way to do this by naming the loggers a specific way and how would I handle this in my config?

If the most significant "key" was the user name, then the best naming strategy would be to start the logger names with the user name. Which would allow you to collect all messages that originated from "joel" to one file, and "eli" to another, but would make it harder to collect all message regarding "security" together. Using a user name as a part of a logger name is very unusual.


On Jun 27, 2005, at 3:21 PM, Schuweiler, Joel J. wrote:
Knowing what server a log comes from isn't enough. I need to know which application it's coming from.

This could simply be achieved by requiring everyone to put a certain keyword into the log message and use the StringMatchFilter or by using a custom filter which checks the category name/logger name (what is the proper term for this??).

I'm pretty shocked that there isn't an easy way to do this already.

If the "application" is a significant key in routing the message to the appropriate appender, then encoding in the logger name is the most efficient mechanism to do it. Adding it to the message and using a filter is much less efficient.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to