[ 
https://issues.apache.org/jira/browse/LOG4J2-2639?focusedWorklogId=265742&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-265742
 ]

ASF GitHub Bot logged work on LOG4J2-2639:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Jun/19 14:31
            Start Date: 24/Jun/19 14:31
    Worklog Time Spent: 10m 
      Work Description: rgoers commented on pull request #284: LOG4J2-2639 - 
Allow logging calls to be constructed using a builder pattern
URL: https://github.com/apache/logging-log4j2/pull/284#discussion_r296753242
 
 

 ##########
 File path: 
log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
 ##########
 @@ -2755,77 +2755,114 @@ public void warn(final String message, final Object 
p0, final Object p1, final O
      * @since 3.0
      */
     @Override
-    public  LogBuilder atTrace() {
+    public  LogBuilder trace() {
         if (isTraceEnabled()) {
-            return logBuilder.get().setLevel(Level.TRACE);
+            DefaultLogBuilder builder = logBuilder.get();
+            if (builder.isInUse()) {
+                return new DefaultLogBuilder(this);
+            }
+            return builder.setLevel(Level.TRACE);
         } else {
-            return LogBuilder.INSTANCE;
+            return LogBuilder.NOOP;
         }
     }
     /**
-     * Constuct a trace log event.
+     * Constuct a debug log event.
      * @return a LogBuilder.
      * @since 3.0
      */
     @Override
-    public LogBuilder atDebug() {
+    public LogBuilder debug() {
         if (isDebugEnabled()) {
+            DefaultLogBuilder builder = logBuilder.get();
+            if (builder.isInUse()) {
+                return new DefaultLogBuilder(this);
+            }
             return logBuilder.get().setLevel(Level.DEBUG);
         } else {
-            return LogBuilder.INSTANCE;
+            return LogBuilder.NOOP;
 
 Review comment:
   There is no need for a new method. I have modified them to all call 
atLevel().
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 265742)
    Time Spent: 2h 50m  (was: 2h 40m)

> Allow log event to be created using the builder pattern.
> --------------------------------------------------------
>
>                 Key: LOG4J2-2639
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2639
>             Project: Log4j 2
>          Issue Type: Task
>          Components: API
>    Affects Versions: 3.0.0
>            Reporter: Ralph Goers
>            Priority: Major
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> In some cases it would be convenient to create log events using a builder 
> pattern. One advantage of this approach is that it would allow the location 
> information to be more easily provided.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to