You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Chris Stefanic (JIRA)" <ji...@apache.org> on 2012/09/05 18:53:07 UTC
[jira] [Created] (LOG4J2-79) Log Levels & Appenders
Chris Stefanic created LOG4J2-79:
------------------------------------
Summary: Log Levels & Appenders
Key: LOG4J2-79
URL: https://issues.apache.org/jira/browse/LOG4J2-79
Project: Log4j 2
Issue Type: Wish
Components: Core
Reporter: Chris Stefanic
Priority: Minor
I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Commented] (LOG4J2-79) Log Levels & Appenders
Posted by "Chris Stefanic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13452511#comment-13452511 ]
Chris Stefanic commented on LOG4J2-79:
--------------------------------------
Paul Benedict edited comment on LOG4J2-79 at 9/7/12 5:59 AM:
-------------------------------------------------------------
Chris, log4j has the ability to compound appenders and to override/replace appenders. For example: your default logger could be a log file but your logger for a particular class could go to email and/or log file. You accomplish this by using the @additivity attribute.
Also, you are incorrect stating levels are in a hierarchy. Loggers are in a hierarchy but not levels. Levels are in a priority list. There is no apparent priority to EMAIL -- saying it belongs between DEBUG and INFO is illogical -- which is a great indicator to show that, as I said, this is a misuse of the Level concept.
Ralph Goers edited comment on LOG4J2-79 at 9/7/12 3:46 AM:
-----------------------------------------------------------
I'm not sure I understand the question about turning markers on or off. Developers add a marker to a logging event by including it in the logging method call. In the logging configuration you can add filters to look for them. If you don't have a filter that evaluates markers then they have no effect on filtering. Of course, the layout you choose can include the marker in its output if it chooses to.
My Response
Pardon my ignorance on Levels. As you stated Loggers are in a hierarchy. If I understand the Log4j.2.X documentation correctly each Logger has a LoggerConfig object associated to it and each LoggerConfig will be assigned a Log Level (TRACE, DEBUG, INFO, WARN, ERROR and FATAL). The LoggerConfig objects uses Filters to determine if a LogEvent will be passed to an Appender. I’m guessing one of the rules on whether or not to pass a LogEvent to an Appender is the Level definition. The table on Webpage; http://logging.apache.org/log4j/2.x/manual/architecture.html before the “Filter” section explains that filtering. The table depicts a filtering hierarchy from left to right starting with TRACE, next is DEBUG, next is INFO, next is WARN, next is ERROR and finally FATAL. The table depicts if a Logger has LoggerConfig object configured with a Log Level of INFO then the following “logger.trace”, “logger.debug” and “logger.info” will pass the filtering test and be passed onto the Appenders attached to the “Logger”. If a “logger.warn” is passed to the “Logger” it will not pass the filter test and therefore will not be passed to the Appenders associated to the “Logger”.
So, what I should have initially stated is that I would like the ability to email a LogEvent and have the ability to “filter” them ( turn on / off ) pass /do not pass to the Appenders. As I understand it that ability to “filter” is done through a Log Level definition. I believe “EMAIL” is a distinct Event Level and it’s placement in the hierarchy should be such that when a Logger with a LoggerConfig object is configured with an “EMAIL” Level the filtering would work such that the following “logger.trace”, “logger.debug” and “logger.email” will pass the filtering test and be passed onto the Appenders attached to the “logger”. If a “logger.info” is passed to the “logger” it will not pass the filter test and therefore will not be passed to the Appenders associated to the “logger”.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Commented] (LOG4J2-79) Log Levels & Appenders
Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13448999#comment-13448999 ]
Ralph Goers commented on LOG4J2-79:
-----------------------------------
First, the ASF doesn't work on a BDFL model, so my opinions count the same as any other PMC member. That said, it is frequently said that ASF projects are a "do-ocracy" - those who do the work get what they want or need.
As for the SMTP Appender, I really haven't had a need for one. But if Log4j 1.x has it I'll probably find a way to port it over at some point. If you need it sooner, patches are encouraged!
As to my feeling about log levels - see LOG4J2-41. I would personally be more inclined to find a way to enhance markers than to allow custom levels - if it means Level cannot be an enum.
in the use case you describe why would it be any harder to create an EMAIL marker and attach it to the log event as opposed to having an EMAIL level? Why does a STAT marker not work for the second use case?
For what you want to do I would suggest looking at the EventLogger class in the Log4j 2 API.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Comment Edited] (LOG4J2-79) Log Levels & Appenders
Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449810#comment-13449810 ]
Paul Benedict edited comment on LOG4J2-79 at 9/7/12 3:57 AM:
-------------------------------------------------------------
Chris, log4j has the ability to compound appenders and to override/replace appenders. For example: your default logger could be a log file but your logger for a particular class could go to email and/or log file. You accomplish this by using the @additivity attribute.
was (Author: paul4christ79):
Chris, log4j has the ability to compound appenders and to override/replace appenders. For example: your default logger could be a log file but your logger for a particular class could go to email and/or log file. You accomplish this by using the addivitiy attribute.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Commented] (LOG4J2-79) Log Levels & Appenders
Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13448897#comment-13448897 ]
Paul Benedict commented on LOG4J2-79:
-------------------------------------
As for your custom EMAIL log level, I think that's the wrong use of a level. A destination type (log, email, database) isn't a log level but an appender. I don't think you would want to continue this route -- just set a special appender for where you want your messages delivered by mail.
Let's see what Ralph says. I think it would be pretty neat to define a custom level still. Obviously it couldn't be an enum, but in the last iteration of Log4j, those enum values did related to some sort of integer relevance (100, 200, etc.). Would a custom level be better suited as an integer relevance or just some custom string? There are trade-offs to each obviously.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Comment Edited] (LOG4J2-79) Log Levels & Appenders
Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13452652#comment-13452652 ]
Ralph Goers edited comment on LOG4J2-79 at 9/11/12 1:24 PM:
------------------------------------------------------------
In log4j 2 you can code
<logger name="myLogger" level="debug>
<appender-ref ref="Console"/>
</logger>
This is exactly equivalent to
<logger name="myLogger" level="trace">
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</logger>
The logger always has an implicit filter that checks for the log level that works exactly as the ThresholdFilter does. The ThresholdFilter is checked after the implicit log level check is performed.
In the case for what you are doing you can do:
logger.info(MarkerManager.getMarker("EMAIL"), "This is my email text");
and then configure
<logger name="myLogger" level="trace" additivity="false">
<MarkerFilter marker="EMAIL" onMatch="ACCEPT" onMismatch="DENY"/>
<appender-ref ref="Console"/>
</logger>
in this case any log event that has an email marker, such as the one above, will be handled by the myLogger logger and passed to the Console appender. Note that you can still independently modify the log level in the configuration to get exactly the behavior you desire.
This provides much more flexibility than adding custom a custom level does. Furthermore, despite your description above I have to agree that EMAIL is not a log level as it is not even close to being obvious where in the level list EMAIL would fall. Why wouldn't SMS or VOICE also be levels and where would they fall respective to EMAIL? To be honest, if I was the architect for your system (as you've described it) I wouldn't even be using a Marker called EMAIL, but one called ALERT or NOTIFY or something similar. I would then create a custom Appender that gets these events (in the manner I described) and then that appender would figure out who to deliver the event to and whether the event should be delivered via Email, SMS or phone.
was (Author: ralph.goers@dslextreme.com):
In log4j 2 you can code
<logger name="myLogger" level="debug>
<appender-ref ref="Console"/>
</logger>
This is exactly equivalent to
<logger name="myLogger" level="trace">
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</logger>
The logger always has an implicit filter that checks for the log level that works exactly as the ThresholdFilter does. However, the ThresholdFilter is actually checked before the implicit level check is done.
In the case for what you are doing you can do:
logger.info(MarkerManager.getMarker("EMAIL"), "This is my email text");
and then configure
<logger name="myLogger" level="trace" additivity="false">
<MarkerFilter marker="EMAIL" onMatch="ACCEPT" onMismatch="DENY"/>
<appender-ref ref="Console"/>
</logger>
in this case any log event that has an email marker, such as the one above, will be handled by the myLogger logger and passed to the Console appender. Note that you can still independently modify the log level in the configuration to get exactly the behavior you desire.
This provides much more flexibility than adding custom a custom level does. Furthermore, despite your description above I have to agree that EMAIL is not a log level as it is not even close to being obvious where in the level list EMAIL would fall. Why wouldn't SMS or VOICE also be levels and where would they fall respective to EMAIL? To be honest, if I was the architect for your system (as you've described it) I wouldn't even be using a Marker called EMAIL, but one called ALERT or NOTIFY or something similar. I would then create a custom Appender that gets these events (in the manner I described) and then that appender would figure out who to deliver the event to and whether the event should be delivered via Email, SMS or phone.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Comment Edited] (LOG4J2-79) Log Levels & Appenders
Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449794#comment-13449794 ]
Ralph Goers edited comment on LOG4J2-79 at 9/7/12 3:46 AM:
-----------------------------------------------------------
I'm not sure I understand the question about turning markers on or off. Developers add a marker to a logging event by including it in the logging method call. In the logging configuration you can add filters to look for them. If you don't have a filter that evaluates markers then they have no effect on filtering. Of course, the layout you choose can include the marker in its output if it chooses to.
was (Author: ralph.goers@dslextreme.com):
I'm not sure I understand the question about turning markers on or off. Developers add a marker to a logging event by including it in the logging method call. In the logging configuration you can add filters to look for them. If you don't have a filter that evaluates markers then they have no effect.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Comment Edited] (LOG4J2-79) Log Levels & Appenders
Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449810#comment-13449810 ]
Paul Benedict edited comment on LOG4J2-79 at 9/7/12 5:59 AM:
-------------------------------------------------------------
Chris, log4j has the ability to compound appenders and to override/replace appenders. For example: your default logger could be a log file but your logger for a particular class could go to email and/or log file. You accomplish this by using the @additivity attribute.
Also, you are incorrect stating levels are in a hierarchy. Loggers are in a hierarchy but not levels. Levels are in a priority list. There is no apparent priority to EMAIL -- saying it belongs between DEBUG and INFO is illogical -- which is a great indicator to show that, as I said, this is a misuse of the Level concept.
was (Author: paul4christ79):
Chris, log4j has the ability to compound appenders and to override/replace appenders. For example: your default logger could be a log file but your logger for a particular class could go to email and/or log file. You accomplish this by using the @additivity attribute.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Commented] (LOG4J2-79) Log Levels & Appenders
Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13452652#comment-13452652 ]
Ralph Goers commented on LOG4J2-79:
-----------------------------------
In log4j 2 you can code
<logger name="myLogger" level="debug>
<appender-ref ref="Console"/>
</logger>
This is exactly equivalent to
<logger name="myLogger" level="trace">
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</logger>
The logger always has an implicit filter that checks for the log level that works exactly as the ThresholdFilter does. However, the ThresholdFilter is actually checked before the implicit level check is done.
In the case for what you are doing you can do:
logger.info(MarkerManager.getMarker("EMAIL"), "This is my email text");
and then configure
<logger name="myLogger" level="trace" additivity="false">
<MarkerFilter marker="EMAIL" onMatch="ACCEPT" onMismatch="DENY"/>
<appender-ref ref="Console"/>
</logger>
in this case any log event that has an email marker, such as the one above, will be handled by the myLogger logger and passed to the Console appender. Note that you can still independently modify the log level in the configuration to get exactly the behavior you desire.
This provides much more flexibility than adding custom a custom level does. Furthermore, despite your description above I have to agree that EMAIL is not a log level as it is not even close to being obvious where in the level list EMAIL would fall. Why wouldn't SMS or VOICE also be levels and where would they fall respective to EMAIL? To be honest, if I was the architect for your system (as you've described it) I wouldn't even be using a Marker called EMAIL, but one called ALERT or NOTIFY or something similar. I would then create a custom Appender that gets these events (in the manner I described) and then that appender would figure out who to deliver the event to and whether the event should be delivered via Email, SMS or phone.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Commented] (LOG4J2-79) Log Levels & Appenders
Posted by "Chris Stefanic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449781#comment-13449781 ]
Chris Stefanic commented on LOG4J2-79:
--------------------------------------
Paul:
As for your custom EMAIL log level, I think that's the wrong use of a level. A destination type (log, email, database) isn't a log level but an appender. I don't think you would want to continue this route -- just set a special appender for where you want your messages delivered by mail.
My Response: I do agree that it is an “Appender”. All the defined “Appenders” direct output to a particular destination, Console, File, JMS Queue, etc. For “EMAIL” it quite obvious the destination is an email address, but the EMAIL Appender should also have the ability to direct the same output to a file just like most of the “logger.trace” thru “logger.fatal” are directed to a “File” using the FileAppender. The reason for this is most software groups/projects have worked in direct all Application log.debug, log.info etc. statements to a single destination, which is usually a file. This file retains the entire history of events. This is extremely helpful when researching problems because it documents the date-time when event occurred.
I disagree with your statement EMAIL log level is a wrong use of a Level. Levels defined a hierarchy and this hierarchy allows Levels to be turned ON or OFF through the Log Level configuration parameter. The ability to turn OFF a Log Level is extremely important when it comes to EMAIL. The reason is there is an extremely high chance of overloading an email server with messages (spamming) from an application that goes off the deep end, a continuous loop, and that loop contains a “logger.email” or a simple Developer mistake of forgetting to remove a line code, “logger.email” used during Development before the code is moved to Production. Having the ability to turn OFF the EMAIL Level would be most beneficial when this situation occurs. This brings up the question where would the EMAIL Level fit in the hierarchy? My answer is between DEBUG and INFO, or provide the ability to configure where the EMAIL level fits into the hierarchy.
Ralph:
As for the SMTP Appender, I really haven't had a need for one. But if Log4j 1.x has it I'll probably find a way to port it over at some point. If you need it sooner, patches are encouraged!
Answer: No I don’t need it immediately, but it is a feature that will provide a great deal of benefit to development and production support teams.
As to my feeling about log levels - see LOG4J2-41. I would personally be more inclined to find a way to enhance markers than to allow custom levels - if it means Level cannot be an enum.
Question: Is there a way to turn ON and OFF “markers”? If not then my explanation above describes why it should be a Level.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Closed] (LOG4J2-79) Log Levels & Appenders
Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralph Goers closed LOG4J2-79.
-----------------------------
Resolution: Invalid
This issue covers several topics. Rather than change the title to reflect adding the SMTPAppender I am suggesting that you create a new Jira issue focused on that. If you still have other questions on Log Levels, markers, etc. please post them on the users or dev list.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Commented] (LOG4J2-79) Log Levels & Appenders
Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449810#comment-13449810 ]
Paul Benedict commented on LOG4J2-79:
-------------------------------------
Chris, log4j has the ability to compound appenders and to override/replace appenders. For example: your default logger could be a log file but your logger for a particular class could go to email and/or log file. You accomplish this by using the addivitiy attribute.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[jira] [Commented] (LOG4J2-79) Log Levels & Appenders
Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4J2-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449794#comment-13449794 ]
Ralph Goers commented on LOG4J2-79:
-----------------------------------
I'm not sure I understand the question about turning markers on or off. Developers add a marker to a logging event by including it in the logging method call. In the logging configuration you can add filters to look for them. If you don't have a filter that evaluates markers then they have no effect.
> Log Levels & Appenders
> ----------------------
>
> Key: LOG4J2-79
> URL: https://issues.apache.org/jira/browse/LOG4J2-79
> Project: Log4j 2
> Issue Type: Wish
> Components: Core
> Reporter: Chris Stefanic
> Priority: Minor
>
> I’m currently working in a software development group that uses the Log4j.1.x and I am looking at upgrading to Log4j.2.x to take advantage of the performance improvements. In my previous development groups we wrote our on Logging utilities due to Log4j.1.x performance problems and it did not support all the functionality required to support our system. Two main functions in our homegrown Logging utility was the ability to send email (logger.email) and record transaction statistical (logger.stat) information.
> In Log4j.1.x there is a SMTPAppender that provides the email capability but I don’t see that Appender in the Log4j.2.x Appender collection. When implemented, the SMTPAppender would publish an email for log levels ERROR and FATAL and could be changed to publish for the other log levels; WARN, INFO or a self-defined Level. The Log4j.2.x documentation states the Logging Levels are now an ENUM and cannot be sub-classed and to use “Markers” for more granularity. In our homegrown Logging utility the “EMAIL” level was distinct because not all ERROR/FATAL require an email to be sent and not all EMAIL are ERROR/FATAL. Are there any plains to include or write a new SMTPAppender in Log4j.2.x? If the SMTPAppender becomes available in Log4j.2 can you/will create a new Level, “EMAIL” to support a distinct Logging Level?
> In our homegrown Logging Utility we also had a “STAT” (transactional/statistical) Logging Level. This Level was used to record relevant data for a unit of work performed by the system. These messages were logged to a distinct file and in some cases the data was also sent to in house Monitoring and Control Diagnostics system. These log messages were not INFO, WARN, ERROR etc. As in the EMAIL log level what is the possibility of adding another Logging Level, STAT to the defined ENUM or provide the ability to create new Levels?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org