You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2012/11/04 15:06:37 UTC

[v2] org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message, Throwable)

I wonder if in:

org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message,
Throwable)

    @Override
    public void log(Marker marker, String fqcn, Level level, Message data,
Throwable t) {
        if (data == null) {
            data = new SimpleMessage("");
        }
        config.config.getConfigurationMonitor().checkConfiguration();
        config.loggerConfig.log(getName(), marker, fqcn, level, data, t);
    }

The null guard should be pushed all the way down to:

org.apache.logging.log4j.core.impl.Log4jLogEvent.Log4jLogEvent(String,
Marker, String, Level, Message, Throwable, Map<String, String>,
ContextStack, String, StackTraceElement, long)

Which already does some constructor checks for other args.

?

Gary
-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: [v2] org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message, Throwable)

Posted by Gary Gregory <ga...@gmail.com>.
Doh!

Gary

On Nov 4, 2012, at 18:11, Benedikt Ritter <be...@gmail.com> wrote:

> Hey Gary,
>
> wrong ML? ;-)
>
> Regards,
> Benedikt
>
> Von meinem iPhone gesendet
>
> Am 04.11.2012 um 15:06 schrieb Gary Gregory <ga...@gmail.com>:
>
>> I wonder if in:
>>
>> org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message,
>> Throwable)
>>
>>   @Override
>>   public void log(Marker marker, String fqcn, Level level, Message data,
>> Throwable t) {
>>       if (data == null) {
>>           data = new SimpleMessage("");
>>       }
>>       config.config.getConfigurationMonitor().checkConfiguration();
>>       config.loggerConfig.log(getName(), marker, fqcn, level, data, t);
>>   }
>>
>> The null guard should be pushed all the way down to:
>>
>> org.apache.logging.log4j.core.impl.Log4jLogEvent.Log4jLogEvent(String,
>> Marker, String, Level, Message, Throwable, Map<String, String>,
>> ContextStack, String, StackTraceElement, long)
>>
>> Which already does some constructor checks for other args.
>>
>> ?
>>
>> Gary
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
>> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [v2] org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message, Throwable)

Posted by Benedikt Ritter <be...@gmail.com>.
Hey Gary,

wrong ML? ;-)

Regards,
Benedikt

Von meinem iPhone gesendet

Am 04.11.2012 um 15:06 schrieb Gary Gregory <ga...@gmail.com>:

> I wonder if in:
> 
> org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message,
> Throwable)
> 
>    @Override
>    public void log(Marker marker, String fqcn, Level level, Message data,
> Throwable t) {
>        if (data == null) {
>            data = new SimpleMessage("");
>        }
>        config.config.getConfigurationMonitor().checkConfiguration();
>        config.loggerConfig.log(getName(), marker, fqcn, level, data, t);
>    }
> 
> The null guard should be pushed all the way down to:
> 
> org.apache.logging.log4j.core.impl.Log4jLogEvent.Log4jLogEvent(String,
> Marker, String, Level, Message, Throwable, Map<String, String>,
> ContextStack, String, StackTraceElement, long)
> 
> Which already does some constructor checks for other args.
> 
> ?
> 
> Gary
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [v2] org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message, Throwable)

Posted by Ralph Goers <ra...@dslextreme.com>.
I suppose it might be safer although it appears that the only code path to create an event (other than in test classes) is through this code.

Ralph

On Nov 4, 2012, at 4:56 PM, Gary Gregory wrote:

> Hi All:
> 
> I wonder if in:
> 
> org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message, Throwable)
> 
>     @Override
>     public void log(Marker marker, String fqcn, Level level, Message data, Throwable t) {
>         if (data == null) {
>             data = new SimpleMessage("");
>         }
>         config.config.getConfigurationMonitor().checkConfiguration();
>         config.loggerConfig.log(getName(), marker, fqcn, level, data, t);
>     }
> 
> The null guard should be pushed all the way down to:
> 
> org.apache.logging.log4j.core.impl.Log4jLogEvent.Log4jLogEvent(String, Marker, String, Level, Message, Throwable, Map<String, String>, ContextStack, String, StackTraceElement, long)
> 
> Which already does some constructor checks for other args.
> 
> ?
> 
> Gary
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
> Spring Batch in Action: http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
> 


[v2] org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message, Throwable)

Posted by Gary Gregory <ga...@gmail.com>.
Hi All:

I wonder if in:

org.apache.logging.log4j.core.Logger.log(Marker, String, Level, Message,
Throwable)

    @Override
    public void log(Marker marker, String fqcn, Level level, Message data,
Throwable t) {
        if (data == null) {
            data = new SimpleMessage("");
        }
        config.config.getConfigurationMonitor().checkConfiguration();
        config.loggerConfig.log(getName(), marker, fqcn, level, data, t);
    }

The null guard should be pushed all the way down to:

org.apache.logging.log4j.core.impl.Log4jLogEvent.Log4jLogEvent(String,
Marker, String, Level, Message, Throwable, Map<String, String>,
ContextStack, String, StackTraceElement, long)

Which already does some constructor checks for other args.

?

Gary
-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory