Class Log4jLayoutToLogback
- java.lang.Object
-
- org.openrewrite.Recipe
-
- org.openrewrite.java.logging.logback.Log4jLayoutToLogback
-
public class Log4jLayoutToLogback extends org.openrewrite.RecipeLog4jLayoutToLogback.Log4jLayoutToLogbackVisitoroperates on the following assumptions:- A logback-classic layout must extend the
LayoutBase<ILoggingEvent>class. - log4j's format() is renamed to doLayout() in a logback-classic layout.
- LoggingEvent getRenderedMessage() is converted to LoggingEvent getMessage().
- The log4j ignoresThrowable() method is not needed and has no equivalent in logback-classic.
- The activateOptions() method merits further discussion. In log4j, a layout will have its activateOptions() method invoked by log4j configurators, that is PropertyConfigurator or DOMConfigurator just after all the options of the layout have been set. Thus, the layout will have an opportunity to check that its options are coherent and if so, proceed to fully initialize itself.
- In logback-classic, layouts must implement the LifeCycle interface which includes a method called start(). The start() method is the equivalent of log4j's activateOptions() method.
- See Also:
- Migration from log4j
- A logback-classic layout must extend the
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLog4jLayoutToLogback.Log4jLayoutToLogbackVisitor
-
Constructor Summary
Constructors Constructor Description Log4jLayoutToLogback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription()java.lang.StringgetDisplayName()protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext>getSingleSourceApplicableTest()protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext>getVisitor()-
Methods inherited from class org.openrewrite.Recipe
causesAnotherCycle, doNext, equals, getApplicableTest, getDescriptor, getEstimatedEffortPerOccurrence, getJacksonPolymorphicTypeTag, getLanguages, getName, getRecipeList, getTags, hashCode, run, run, run, run, validate, validate, validateAll, validateAll, visit
-
-
-
-
Method Detail
-
getDisplayName
public java.lang.String getDisplayName()
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
public java.lang.String getDescription()
- Overrides:
getDescriptionin classorg.openrewrite.Recipe
-
getSingleSourceApplicableTest
protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getSingleSourceApplicableTest()
- Overrides:
getSingleSourceApplicableTestin classorg.openrewrite.Recipe
-
getVisitor
protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
- Overrides:
getVisitorin classorg.openrewrite.Recipe
-
-