-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
AsyncLogger constructor access changed from public to package-private at 2.24.3 code change - #3263 blocked our CustomLogger instances initialization.
We have a requirement to introduce extra enablement checks in AsyncLogger isEnabled methods to control print out logs or not. Actually AsyncLogger is not extension friendly due to internal referenced AsyncLoggerDisruptor.class constructor is private. Before 2.24.3, we've created CustomLogger with the same package org.apache.logging.log4j.core.async as AsyncLogger and use reflection to initialize CustomLogger instances and it is working 7+ years.
Code sample,
package org.apache.logging.log4j.core.async;
public class CustomLogger extends AsyncLogger {
@Override
public boolean isEnabled(final Level level, final Marker marker, final String message) {
if (isCustomEnablementOn) {
return true;
}
return super.isEnabled(level, marker, message);
}
}
Asks
Change AsyncLogger constructor access back to public and consider make AsyncLogger more extensible, user can extend, override AsyncLogger and create subclass of AsyncLogger instance directly, no limitation on private AsyncLoggerDisruptor.class or others internal referenced classes access.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status