logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: [2/6] git commit: LOG4J2-589 Added logging, minor improvements.
Date Thu, 25 Sep 2014 22:40:24 GMT
To be honest I'm still not really clear on that bit. I found some code that handles plug-ins
of category "level" but that code works differently than I expect...

I will add some new questions in the Jira comments soon. 

Sent from my iPhone

> On 2014/09/26, at 2:57, Matt Sicker <boards@gmail.com> wrote:
> 
> You figured out the category thing, right? It's because anything that's an XML element
has to be in the Core category (which is what the Core category seems to be for).
> 
> ---------- Forwarded message ----------
> From: <rpopma@apache.org>
> Date: 25 September 2014 12:24
> Subject: [2/6] git commit: LOG4J2-589 Added logging, minor improvements.
> To: commits@logging.apache.org
> 
> 
> LOG4J2-589 Added logging, minor improvements.
> 
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9f76d5eb
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9f76d5eb
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9f76d5eb
> 
> Branch: refs/heads/LOG4J2-589
> Commit: 9f76d5eba818269aa5474207519b9b4d9e2e6448
> Parents: 5427dea
> Author: rpopma <rpopma@apache.org>
> Authored: Fri Sep 26 02:15:21 2014 +0900
> Committer: rpopma <rpopma@apache.org>
> Committed: Fri Sep 26 02:17:58 2014 +0900
> 
> ----------------------------------------------------------------------
>  .../apache/logging/log4j/core/config/CustomLevelPlugin.java  | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9f76d5eb/log4j-core/src/main/java/org/apache/logging/log4j/core/config/CustomLevelPlugin.java
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/CustomLevelPlugin.java
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/CustomLevelPlugin.java
> index ba0a260..532e811 100644
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/CustomLevelPlugin.java
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/CustomLevelPlugin.java
> @@ -20,11 +20,12 @@ import org.apache.logging.log4j.Level;
>  import org.apache.logging.log4j.core.config.plugins.Plugin;
>  import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
>  import org.apache.logging.log4j.core.config.plugins.PluginFactory;
> +import org.apache.logging.log4j.status.StatusLogger;
> 
>  /**
>   * Custom Level object that is created via configuration.
>   */
> -@Plugin(name = "CustomLevel", category = "Core") // TBD: category="Level" does not work...
Why?
> +@Plugin(name = "CustomLevel", category = "Core", printObject = true)
>  public final class CustomLevelPlugin {
> 
>      private CustomLevelPlugin() {
> @@ -38,11 +39,12 @@ public final class CustomLevelPlugin {
>       * @return A Level object.
>       */
>      @PluginFactory
> -    public static Level createLevel(
> -// @formatter:off
> +    public static Level createLevel(// @formatter:off
>              @PluginAttribute("name") final String levelName,
>              @PluginAttribute("intLevel") final int intLevel) {
>          // @formatter:on
> +
> +        StatusLogger.getLogger().debug("Creating CustomLevel(name='{}', intValue={})",
levelName, intLevel);
>          Level result = Level.forName(levelName, intLevel);
>          return result;
>      }
> 
> 
> 
> 
> -- 
> Matt Sicker <boards@gmail.com>

Mime
View raw message