You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "rh-id (via GitHub)" <gi...@apache.org> on 2024/02/16 08:35:38 UTC

[PR] Unnecessary Object creation when logging InternalSheet.java [poi]

rh-id opened a new pull request, #590:
URL: https://github.com/apache/poi/pull/590

   (no comment)


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Unnecessary Object creation when logging InternalSheet.java [poi]

Posted by "rh-id (via GitHub)" <gi...@apache.org>.
rh-id commented on PR #590:
URL: https://github.com/apache/poi/pull/590#issuecomment-1948257293

   Hi @pjfanning @xzel23 ,
   Thanks for the review, I had updated the commit.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Unnecessary Object creation when logging InternalSheet.java [poi]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #590:
URL: https://github.com/apache/poi/pull/590#issuecomment-1948573311

   Thanks @rh-id, @xzel23 - merged


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Unnecessary Object creation when logging InternalSheet.java [poi]

Posted by "xzel23 (via GitHub)" <gi...@apache.org>.
xzel23 commented on PR #590:
URL: https://github.com/apache/poi/pull/590#issuecomment-1948269233

   @pjfanning Looks good to me. What do you think?


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Unnecessary Object creation when logging InternalSheet.java [poi]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #590:
URL: https://github.com/apache/poi/pull/590#discussion_r1492210329


##########
poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java:
##########
@@ -541,12 +540,11 @@ public ConditionalFormattingTable getConditionalFormattingTable() {
     public void setDimensions(int firstrow, short firstcol, int lastrow, short lastcol)
     {
         LOGGER.atDebug().log("Sheet.setDimensions");
-        LOGGER.atDebug().log(() -> new SimpleMessage(

Review Comment:
   -1 from me. This lambda function only runs when debug is enabled. Debug is not normally enabled. 
   
   With your change the expensive String concat will always run, regardless of whether the text needs to be output.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Unnecessary Object creation when logging InternalSheet.java [poi]

Posted by "asfgit (via GitHub)" <gi...@apache.org>.
asfgit closed pull request #590: Unnecessary Object creation when logging InternalSheet.java
URL: https://github.com/apache/poi/pull/590


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Unnecessary Object creation when logging InternalSheet.java [poi]

Posted by "xzel23 (via GitHub)" <gi...@apache.org>.
xzel23 commented on code in PR #590:
URL: https://github.com/apache/poi/pull/590#discussion_r1492235388


##########
poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java:
##########
@@ -541,12 +540,11 @@ public ConditionalFormattingTable getConditionalFormattingTable() {
     public void setDimensions(int firstrow, short firstcol, int lastrow, short lastcol)
     {
         LOGGER.atDebug().log("Sheet.setDimensions");
-        LOGGER.atDebug().log(() -> new SimpleMessage(

Review Comment:
   Correct. And while we are at it: since we are at Log4J2 now, I think we should instead better use something like this:
   ```
           LOGGER.debug("Sheet.setDimensions");
           LOGGER.debug("firstrow{}firstcol{}lastrow{}lastcol{}", firstrow, firstcol, lastrow, lastcol);
   
   ```
   
   So, get rid of the `atDebug()`where not necessary and use the MessageFormat.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Unnecessary Object creation when logging InternalSheet.java [poi]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #590:
URL: https://github.com/apache/poi/pull/590#discussion_r1492258847


##########
poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java:
##########
@@ -541,12 +540,11 @@ public ConditionalFormattingTable getConditionalFormattingTable() {
     public void setDimensions(int firstrow, short firstcol, int lastrow, short lastcol)
     {
         LOGGER.atDebug().log("Sheet.setDimensions");
-        LOGGER.atDebug().log(() -> new SimpleMessage(

Review Comment:
   if we do change this line, I suggest that we improve the format of its output - eg 
   ```
   LOGGER.debug("firstrow: {} firstcol: {} lastrow: {} lastcol: {}", firstrow, firstcol, lastrow, lastcol);
   ```



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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