Bug 40667 - Change protected Loggers to private
Summary: Change protected Loggers to private
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.92
Hardware: PC other
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-03 06:53 UTC by Andrejus Chaliapinas
Modified: 2012-04-01 06:39 UTC (History)
1 user (show)



Attachments
Corrects Logger in several LM classes (4.01 KB, patch)
2006-10-03 07:03 UTC, Andrejus Chaliapinas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrejus Chaliapinas 2006-10-03 06:53:54 UTC
 
Comment 1 Andrejus Chaliapinas 2006-10-03 07:03:57 UTC
Created attachment 18956 [details]
Corrects Logger in several LM classes

Corrects (adds where missed) Logger from protected to private in these classes:

LineLayoutManager, TableCellLayoutManager, TableLayoutManager,
BreakingAlgorithm, PageBreakingAlgorithm
Comment 2 Simon Pepping 2006-10-04 12:15:03 UTC
Andrejus,

Thanks for your patch. I have a few comments.

1. Your patch for src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
reads:

     /** the logger for the class */
     protected static Log classLog = LogFactory.getLog(PageBreakingAlgorithm.class);
 
+    /** the logger for the instance */
+    private static Log log = classLog;

Why don't you remove 'protected static Log classLog'?

Re the comment, a static variable is for the class, not for the instance.

2. In the LayoutManagers, there is a protected static Log instance in
org.apache.fop.layoutmgr.AbstractBaseLayoutManager, assigned to class LayoutManager:

protected static Log log = LogFactory.getLog(LayoutManager.class)

This is used by all LayoutManagers. I can imagine that you find this too coarse,
and prefer to see a different logger for each LayoutManager, but then it would
be better to do so for each LayoutManager.

Regards, Simon
Comment 3 Andrejus Chaliapinas 2006-10-04 12:24:00 UTC
Hi Simon,

I prefer to touch others code in very kind matter, meaning that I'd like to 
see as small recompiling as possible (in this case I wanted to touch just log 
members and not classLog I had no knowledge about). Yes, there is next step to 
do to change all other protected Loggers for LMs, but for me it would be much 
easier to to if we would deal with code tagging/modules/SVN branches instead 
of direct text patches. Right now I've applied Patrick's patch and to change 
other Loggers to private as well I would need once again to checkout whole 
source tree to another project and make those changes there. Actually I've 
planned finish that after I'll get some understanding of Patrick's code as 
well as with LMs invocations.

Sorry if it seems incomplete for you right now, but I've tried to make code 
after changes to be compilable.

Andrejus
Comment 4 Simon Pepping 2006-10-04 12:33:37 UTC
(In reply to comment #3)

> members and not classLog I had no knowledge about). Yes, there is next step to 
> do to change all other protected Loggers for LMs, but for me it would be much 
> easier to to if we would deal with code tagging/modules/SVN branches instead 
> of direct text patches. Right now I've applied Patrick's patch and to change 

Indeed, doing this by patches is bothersome. But as it is, the patch is a bit
small and random. I would prefer it if you would make the required changes in
your working copy and submit them in a patch which contains more work.

Of course, I could make the changes to the LM tree myself. What do the FOP
committers think: Give each LM its own logger? It will provide more clarity
during debugging, but it will also increase the number of loggers considerably.

Simon
Comment 5 Jeremias Maerki 2006-10-04 14:13:34 UTC
(In reply to comment #4)
> Of course, I could make the changes to the LM tree myself. What do the FOP
> committers think: Give each LM its own logger? It will provide more clarity
> during debugging, but it will also increase the number of loggers considerably.

+1 from me. It bugs me every now and then but so far I've never had enough
energy to actually do something about it. I only changed something for the
breaking algorithm where it was essential for me to keep line break stuff apart
from page break stuff while debugging.
Comment 6 Simon Pepping 2006-10-05 11:46:08 UTC
Patch extended to all LMs which use a logger and applied. Andrejus, thanks for
your patch.
Comment 7 Glenn Adams 2012-04-01 06:39:29 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed