Re: logger changes for 2.11.0

2021-12-17 Thread Jim Wise
Does this work for you?

I have this config (albeit with a different fileName), and while the files are 
created, they do not receive any log messages.
-- 
Jim Wise
jw...@draga.com





> On Dec 17, 2021, at 16:31, Juan Pablo Santos Rodríguez 
>  wrote:
> 
> Hi Jürgen,
> 
> there's a commented section on the jspwiki.properties file setting up
> a rolling appender for the security log. The default configuration
> should be the same as before, translated from the equivalent log4j1
> configuration that was in place. With that example, the following
> works for me:
> 
> status = warn
> name = jspwiki-log4j2-configuration
> 
> apenders=console
> appender.console.type = Console
> appender.console.name = STDOUT
> appender.console.layout.type = PatternLayout
> appender.console.layout.pattern = %highlight{[%-5level]} %d{-MM-dd
> HH:mm:ss.SSS} [%t] %c{1.} - %msg%n %ex
> 
> appender.rolling.type = RollingFile
> appender.rolling.name = RollingFile
> appender.rolling.fileName = /tmp/jspwiki.log
> appender.rolling.filePattern = jspwiki.log.%d{dd-MMM}.log.gz
> appender.rolling.layout.type = PatternLayout
> appender.rolling.layout.pattern = %d{-MM-dd HH:mm:ss} %-5p %m%n
> appender.rolling.policies.type = Policies
> appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
> appender.rolling.policies.size.size=10MB
> appender.rolling.strategy.type = DefaultRolloverStrategy
> appender.rolling.strategy.max = 5
> 
> # Log to console, file
> loggers=jspwiki
> logger.jspwiki.name = org.apache.wiki
> logger.jspwiki.level = info
> logger.jspwiki.additivity = false
> logger.jspwiki.appenderRef.stdout.ref = STDOUT
> logger.jspwiki.appenderRef.rolling.ref = RollingFile
> 
> I agree that's somewhat verbose. Maybe another option could be use the
> 'jspwiki.use.external.logconfig=true' property and provide custom
> log4j2.[xml|properties|whatever expected by log4j] file? That's what's
> done f.ex. on the Docker image. What other default configuration would
> be more suitable? Perhaps providing some file appenders, but no using
> them by default? I don't have a strong opinion on that so, for the
> default log configuration with Log4J2 I went with the same as with
> Log4J.
> 
> Regarding the API change, it's not mandatory to do it in order to
> migrate to 2.11 (although I'd recommend it to do it as soon as
> possible, as the old methods should disappear on a-not-yet-defined
> moment in the future). The jspwiki-210-adapters artifact should
> reroute old methods to new ones. The jspwiki-210-test-adaptees tests
> that the former module behaves as expected so, if it doesn't, then
> that should be a bug :-/
> 
> The rationale of the change began on JSPWIKI-303 (to provide an API
> library); unfortunately this was easier said than done, as the
> signature of the methods included the WikiContext, which is tied to
> the WikiEngine, which in turn is tied to almost all JSPWiki code.
> Thus, all the interfaces extraction for the api module, and the
> changes on the WikiEngine et all between 2.10 and 2.11.
> 
> 
> HTH,
> juan pablo
> 
> On Fri, Dec 17, 2021 at 8:39 PM Jürgen Weber  wrote:
>> 
>> Finally found some time to update to 2.11.0.
>> Experience was mixed.
>> Had to port my plugins to the changed API (kind of frivolous to change
>> the API of a mature product, I dare to say, and break all existing
>> plugins), but this went rather smoothly.
>> But I didn't get the new logging to work. Do I really have to add some
>> 50 lines to my jspwiki-custom.properties to get a simple file logging?
>> Aren't there defaults?
>> Has anybody some simple lines to get a file log?
>> 
>> Thanks,
>> Juergen



Re: logger changes for 2.11.0

2021-12-17 Thread Juan Pablo Santos Rodríguez
Hi Jürgen,

there's a commented section on the jspwiki.properties file setting up
a rolling appender for the security log. The default configuration
should be the same as before, translated from the equivalent log4j1
configuration that was in place. With that example, the following
works for me:

status = warn
name = jspwiki-log4j2-configuration

apenders=console
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %highlight{[%-5level]} %d{-MM-dd
HH:mm:ss.SSS} [%t] %c{1.} - %msg%n %ex

appender.rolling.type = RollingFile
appender.rolling.name = RollingFile
appender.rolling.fileName = /tmp/jspwiki.log
appender.rolling.filePattern = jspwiki.log.%d{dd-MMM}.log.gz
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{-MM-dd HH:mm:ss} %-5p %m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 5

# Log to console, file
loggers=jspwiki
logger.jspwiki.name = org.apache.wiki
logger.jspwiki.level = info
logger.jspwiki.additivity = false
logger.jspwiki.appenderRef.stdout.ref = STDOUT
logger.jspwiki.appenderRef.rolling.ref = RollingFile

I agree that's somewhat verbose. Maybe another option could be use the
'jspwiki.use.external.logconfig=true' property and provide custom
log4j2.[xml|properties|whatever expected by log4j] file? That's what's
done f.ex. on the Docker image. What other default configuration would
be more suitable? Perhaps providing some file appenders, but no using
them by default? I don't have a strong opinion on that so, for the
default log configuration with Log4J2 I went with the same as with
Log4J.

Regarding the API change, it's not mandatory to do it in order to
migrate to 2.11 (although I'd recommend it to do it as soon as
possible, as the old methods should disappear on a-not-yet-defined
moment in the future). The jspwiki-210-adapters artifact should
reroute old methods to new ones. The jspwiki-210-test-adaptees tests
that the former module behaves as expected so, if it doesn't, then
that should be a bug :-/

The rationale of the change began on JSPWIKI-303 (to provide an API
library); unfortunately this was easier said than done, as the
signature of the methods included the WikiContext, which is tied to
the WikiEngine, which in turn is tied to almost all JSPWiki code.
Thus, all the interfaces extraction for the api module, and the
changes on the WikiEngine et all between 2.10 and 2.11.


HTH,
juan pablo

On Fri, Dec 17, 2021 at 8:39 PM Jürgen Weber  wrote:
>
> Finally found some time to update to 2.11.0.
> Experience was mixed.
> Had to port my plugins to the changed API (kind of frivolous to change
> the API of a mature product, I dare to say, and break all existing
> plugins), but this went rather smoothly.
> But I didn't get the new logging to work. Do I really have to add some
> 50 lines to my jspwiki-custom.properties to get a simple file logging?
> Aren't there defaults?
> Has anybody some simple lines to get a file log?
>
> Thanks,
> Juergen


logger changes for 2.11.0

2021-12-17 Thread Jürgen Weber
Finally found some time to update to 2.11.0.
Experience was mixed.
Had to port my plugins to the changed API (kind of frivolous to change
the API of a mature product, I dare to say, and break all existing
plugins), but this went rather smoothly.
But I didn't get the new logging to work. Do I really have to add some
50 lines to my jspwiki-custom.properties to get a simple file logging?
Aren't there defaults?
Has anybody some simple lines to get a file log?

Thanks,
Juergen