Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move configuration format converter from log4j-1.2-api #93

Draft
wants to merge 84 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
b706c31
Make new home for Log4j2
rgoers Feb 6, 2012
00ff9c3
[LOG4J2-63] Support configuration from version 1.x log4j.properties. A
garydgregory Mar 9, 2016
7993d6b
[LOG4J2-63] Support configuration from version 1.x log4j.properties.
garydgregory Mar 9, 2016
31de8a2
[LOG4J2-63] Support configuration from version 1.x log4j.properties.
garydgregory Mar 9, 2016
49c625e
[LOG4J2-63] Support configuration from version 1.x log4j.properties.
garydgregory Mar 9, 2016
46e6554
[LOG4J2-63] Support configuration from version 1.x log4j.properties.
garydgregory Mar 9, 2016
d32aee1
Add TODO
mikaelstaldal Aug 13, 2016
68bae46
Fix Layouts
mikaelstaldal Aug 13, 2016
2f49b54
TTCCLayout for Log4j 1.x compatibility
mikaelstaldal Aug 13, 2016
c28ad40
Add TODOs
mikaelstaldal Aug 13, 2016
930ae56
Do not try to use Log4j 2 XmlLayout in place of Log4j 1 XmlLayout
mikaelstaldal Aug 14, 2016
a567360
Fix comments
mikaelstaldal Aug 14, 2016
087fd9e
Ported Log4j 1's XMLLayout
mikaelstaldal Aug 14, 2016
42fe672
Support Log4j 1 TTCCLayout options
mikaelstaldal Aug 17, 2016
2d5a412
Support Log4j 1 HtmlLayout options
mikaelstaldal Aug 17, 2016
be09fdb
Support Log4j 1 XmlLayout options
mikaelstaldal Aug 17, 2016
7cb262a
Fix comment
mikaelstaldal Aug 17, 2016
d54e9c4
Support %properties in PatternLayout
mikaelstaldal Aug 17, 2016
5d4e01a
Support %ndc in PatternLayout
mikaelstaldal Aug 17, 2016
6db69ac
Fix name of console appender
mikaelstaldal Aug 17, 2016
58f0370
Fix AppenderRef
Aug 18, 2016
fb98dcb
Remove TTCCLayout and use PatternLayout instead
Aug 18, 2016
8727a32
Convert Log4j 1 pattern so it works properly in Log4j 2
mikaelstaldal Aug 21, 2016
5699c11
Split Log4j1 config factory into tiny factory and separate parser
mikaelstaldal Aug 21, 2016
41efb61
Close input stream when done
mikaelstaldal Aug 21, 2016
fdd9790
First commit for branch for [LOG4J2-1547]
garydgregory Aug 24, 2016
03a5a9e
Code clean-up
mikaelstaldal Aug 25, 2016
a66429d
Support FileAppender
mikaelstaldal Aug 25, 2016
54bd048
Use final.
garydgregory Aug 26, 2016
1a20761
Proof-of-concept for Log4j 1.x config conversion
Aug 31, 2016
4d2caf0
Fix error handling in Log4j 1 configuration
Aug 31, 2016
016e894
Format nit.
garydgregory Aug 31, 2016
844685d
Add final modifier to method parameters
garydgregory Sep 7, 2016
d2eed9f
Add final modifier to local variables.
garydgregory Sep 7, 2016
3443076
Remove obsolete comment
Sep 7, 2016
c798399
[LOG4J2-1523] Log4j 1 appenders. NullAppender.
garydgregory Sep 22, 2016
71136da
[LOG4J2-1523] Log4j 1 appenders. Classic RollingFileAppender.
garydgregory Sep 22, 2016
7267de2
Refactor properties ivar access.
garydgregory Sep 22, 2016
cd70374
[LOG4J2-1523] Log4j 1 appenders. Classic RollingFileAppender with
garydgregory Sep 22, 2016
e939f8e
[LOG4J2-1523] Log4j 1 appenders. Classic RollingFileAppender with
garydgregory Sep 22, 2016
8f8077a
[LOG4J2-1523] Log4j 1 appenders. Classic DailyRollingFileAppender.
garydgregory Sep 22, 2016
fc325d2
[LOG4J2-1523] Log4j 1 appenders. Support System properties per Log4j 1
garydgregory Sep 22, 2016
4a7d5b4
Clarify Javadocs.
garydgregory Sep 23, 2016
2ff8310
Better exception message.
garydgregory Sep 23, 2016
6dc903e
Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to
garydgregory Sep 23, 2016
d2812b9
Better error reporting.
garydgregory Sep 24, 2016
e902fb9
Better error reporting.
garydgregory Sep 24, 2016
f53c1c3
Minor refactoring of dup calls.
garydgregory Sep 24, 2016
85ec8b8
Allow for a logger to be defined as "Level, AppenderRef, AppenderRef,
garydgregory Sep 24, 2016
ad622af
Allow for a logger to be defined as "Level, AppenderRef, AppenderRef,
garydgregory Sep 24, 2016
3f6cb0c
Refactor some common code.
garydgregory Sep 24, 2016
6be905c
Do not convert strings to Level objects internally since they can be
garydgregory Sep 24, 2016
8e83773
Convert properties.
garydgregory Sep 24, 2016
c1c2cb7
Remove unused import.
garydgregory Sep 24, 2016
b6f7de2
Sort properties.
garydgregory Sep 24, 2016
93b56a0
toString() is implied.
garydgregory Sep 24, 2016
0be54ee
Fix regression.
garydgregory Sep 24, 2016
cd99435
Code clean ups and sort appender names for a logger's appender refs.
garydgregory Sep 24, 2016
e3a9fe5
Add final modifier to method parameters.
garydgregory Nov 12, 2016
58974f6
Add final modifier to local variables
garydgregory Nov 12, 2016
8899cc7
LOG4J2-2011 replace JCommander command line parser with picocli to le…
remkop Aug 14, 2017
0341e79
LOG4J2-2011 moved classes from util.picocli to tools.picocli
remkop Aug 15, 2017
8690b90
[LOG4J2-3014] Log4j1ConfigurationConverter on Windows produces "
"
garydgregory Feb 3, 2021
b94517c
Remove trailing white spaces on all lines.
garydgregory Jul 29, 2021
af69703
Fix string substitution recursion
carterkozak Dec 16, 2021
3af65c7
Use generics.
garydgregory Jan 13, 2022
a196fcc
Log4j 1.2 bridge throws ClassCastException when using SimpleLayout an…
garydgregory Jan 20, 2022
5342191
Adds support for missing Log4j 1.x properties and fixes default value…
ppkarwasz Feb 4, 2022
c255b12
Remove unused method.
garydgregory Feb 19, 2022
cf8bc91
Allow for whitespace in property files.
garydgregory Feb 19, 2022
8f138d6
Adds Log4j 1.x global threshold (#764)
ppkarwasz Feb 21, 2022
45a0b60
`final` synchronization with 2.17.2
ppkarwasz Mar 30, 2022
42ec510
[LOG4J2-3419] Add a Log4j 1.x level name pattern converter
ppkarwasz Mar 14, 2022
c28d39f
[LOG4J2-3419] Allows %pid in Log4j 1.x patterns
ppkarwasz Mar 23, 2022
3803627
Extract Category annotation from Plugin and add to Key
jvz May 16, 2022
98f9cee
Change `{@literal null}` to `{@code null}` (#1424)
mernst Apr 12, 2023
f37afc1
Apply Spotless to all files
Apr 25, 2023
10f8cc2
Updated default fileIndex for rollover strategy in log4j1
krzyk Aug 21, 2023
fce7b8f
Format using Palantir formatter
Nov 20, 2023
eeff3d7
Generalize DI usage
ppkarwasz Mar 4, 2024
ec14b3f
Revert `ConfigurationFactory` renaming
ppkarwasz Mar 12, 2024
bcece68
Revert changes to methods used by Spring Boot
ppkarwasz Mar 13, 2024
9e527e1
Moven `Log4j1ConfigurationConverter` to new artifact
ppkarwasz Apr 1, 2024
fc9f584
Adapt to external PicoCLI dependency
ppkarwasz Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

target/
# IntelliJ IDEA
.idea
*.iml
*.iws
/out
.flattened-pom.xml
/.mvn/wrapper/maven-wrapper.jar
# Eclipse
.project
.classpath
.settings/
# Generated by Maven
.flattened-pom.xml
dependency-reduced-pom.xml
/.mvn/wrapper/maven-wrapper.jar
target/
146 changes: 146 additions & 0 deletions log4j-config-converter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to you under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-transform-parent</artifactId>
<version>${revision}</version>
<relativePath>../log4j-transform-parent</relativePath>
</parent>

<artifactId>log4j-config-converter</artifactId>
<name>Apache Log4j Configuration converter</name>
<description>Converts between multiple Log4j configuration formats.</description>

<properties>
<!-- Disabling `bnd-baseline-maven-plugin`, since we don't have a release yet to compare against. -->
<bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>

<Main-Class>org.apache.logging.log4j.config.converter.Log4j1ConfigurationConverter</Main-Class>

<!-- Plugin versions -->
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>

<!-- Dependencies -->
<log4j2.version>3.0.0-SNAPSHOT</log4j2.version>
<picocli.version>4.7.5</picocli.version>
</properties>

<dependencyManagement>
<dependencies>

<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>${picocli.version}</version>
</dependency>

</dependencies>
</dependencyManagement>

<dependencies>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>

<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths combine.children="append">
<path>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>${picocli.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-transform-maven-shade-plugin-extensions</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>shade-jar-with-dependencies</id>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer implementation="org.apache.logging.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.logging.log4j.config.converter;

import java.io.IOException;
import java.io.InputStream;

class InputStreamWrapper extends InputStream {

private final String description;
private final InputStream input;

public InputStreamWrapper(final InputStream input, final String description) {
this.input = input;
this.description = description;
}

@Override
public int available() throws IOException {
return input.available();
}

@Override
public void close() throws IOException {
input.close();
}

@Override
public boolean equals(final Object obj) {
return input.equals(obj);
}

@Override
public int hashCode() {
return input.hashCode();
}

@Override
public synchronized void mark(final int readlimit) {
input.mark(readlimit);
}

@Override
public boolean markSupported() {
return input.markSupported();
}

@Override
public int read() throws IOException {
return input.read();
}

@Override
public int read(final byte[] b) throws IOException {
return input.read(b);
}

@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
return input.read(b, off, len);
}

@Override
public synchronized void reset() throws IOException {
input.reset();
}

@Override
public long skip(final long n) throws IOException {
return input.skip(n);
}

@Override
public String toString() {
return getClass().getSimpleName() + " [description=" + description + ", input=" + input + "]";
}
}
Loading