You can convert your complete log4j.properties using this online service, where you can paste your log4j.properties, press convert and copy your new log4j.xml:

http://log4j-props2xml.appspot.com/

If that webapp is offline ... you can also start it in your own servlet container ... you find downloads and sources here:

https://github.com/jroyals/log4j-properties-converter/

Use of variables in log4j.xml:

This is explained in an answer to another question ... using XML internal entities here and using Java System Properties here.

Answer from Jörg on Stack Overflow
🌐
How to do in Java
howtodoinjava.com › home › java xml › java convert xml to properties – read properties from xml file
Java Convert XML to Properties - Read Properties from XML File
March 9, 2023 - String outPropertiesFile = "application.properties"; String inXmlFile = "applicationProperties.xml"; InputStream inStream = new FileInputStream(inXmlFile); //Input XML File OutputStream outStream = new FileOutputStream(outPropertiesFile); //Output properties File Properties props = new Properties(); //Load XML file props.loadFromXML(inStream); //Store to properties file props.store(outStream, "Converted from applicationProperties.xml"); //Use properties in code System.out.println(props.get("input.dir")); //Prints 'c:/temp/input'
🌐
FreeFormatter
freeformatter.com › converters.html
Free Online Converter Tools For Developers - FreeFormatter.com
Free online converter tools for developers, including XSL, XSLT, XML to JSON, JSON to XML and many more!
🌐
Appspot
log4j-props2xml.appspot.com
Log4J Properties to XML Converter
Source code for the converter, including this web application, are available from the Log4J Properties Converter project page. This software is licensed to you under the GNU Public License, version 3.
🌐
Blogger
source-files-translator.blogspot.com › 2016 › 05 › how-to-convert-xml-file-into-properties.html
How to convert XML file into Properties file?-Source Files Translator
Objective-C/Cocoa Property List (.plist),YAML (.yml),Java/Android Resources (.xml),Java Properties csv(.properties),JSON (.json), ... Convert new plist files between XML and binary Apple has been introduced t new .plist file format since 10.4.
🌐
Logback
logback.qos.ch › translator
log4j.properties Translator - Logback
This service allows you to transform logback.xml files into canonical or standard form. The resulting logback.xml file targets logback version 1.3.0 or later. Note that both logback 1.3 and 1.4 support 1.2 configuration files without change. ... This service allows you to transform logback.xml files into a Java class.
Find elsewhere
🌐
Online Tools
onlinetools.com › json › convert-json-to-properties
Convert JSON to Properties – Online JSON Tools
Free online JSON to properties converter. Just load your JSON file in the input field and it will automatically get converted to a properties file.
🌐
Json2CSharp
json2csharp.com › code-converters › xml-to-java
Convert XML to JAVA Object Online - Json2CSharp Toolkit
Use Properties · Use Pascal Case · Convert · Copy To Clipboard · Zip as Files · Looks like there's an unhandled error or your input is not properly formatted. You can report it to the developer by clicking on the "Report To Dev" button. Or you can report it on Github using "Report An Issue". Close Report To Dev · Here's how you can convert your XML string to Java objects or POJO classes, we will be using the converter and built in libraries like 'com.fasterxml.jackson.dataformat' to parse our object.
🌐
FreeFormatter
freeformatter.com › xml-to-json-converter.html
Free Online XML to JSON Converter - FreeFormatter.com
This online tool allows you to convert an XML file into a JSON file. This process is not 100% accurate in that XML uses different item types that do not have an equivalent JSON representation. Attributes are treated as JSON properties and can be prefixed to differentiate them (@ is used by default)
🌐
How to do in Java
howtodoinjava.com › home › java xml › java convert properties file to xml file
Java Convert Properties File to XML File
March 9, 2023 - To convert an XML file to .properties file, follow the steps given in linked tutorial. 1. Create XML File from Properties File To convert the properties file into an XML file, the best way is to use java.util.Properties class.
🌐
Mkyong
mkyong.com › home › java › java – convert properties file to xml
Java - Convert properties file to XML - Mkyong.com
May 16, 2021 - package com.mkyong.xml.tips; import java.io.*; import java.nio.charset.StandardCharsets; import java.util.Properties; public class PropertiesToXml2 { public static void main(String[] args) throws IOException { Properties props = new Properties(); try (InputStream input = new FileInputStream("src/main/resources/application.properties")) { // loads a properties file props.load(input); } try (OutputStream output = new FileOutputStream("c:\\test\\server-config.xml")) { // convert the properties to an XML file props.storeToXML(output, "Server config file", StandardCharsets.UTF_8); } } }
🌐
Json2CSharp
json2csharp.com › code-converters › xml-to-csharp
Convert XML to C# Classes Online - Json2CSharp Toolkit
/* using System.Xml.Serialization; XmlSerializer serializer = new XmlSerializer(typeof(Realestates)); using (StringReader reader = new StringReader(xml)) { var test = (Realestates)serializer.Deserialize(reader); } */ [XmlRoot(ElementName="additionalCosts")] public class AdditionalCosts { [XmlElement(ElementName = "value")] public string Value { get; set; } [XmlElement(ElementName = "currency")] public string Currency { get; set; } [XmlElement(ElementName = "marketingType")] public string MarketingType { get; set; } [XmlElement(ElementName = "priceIntervalType")] public string PriceIntervalType
🌐
engineerdatahelper
engineerdatahelper.wordpress.com › 2016 › 04 › 27 › xml-to-properties
How to convert XML file into Properties file? | engineerdatahelper
April 27, 2016 - In this article, we show you how to convert XML file into Properties file. See following XML file : Guide load the original file or files Settings and click Output directory Choose a Properties Format Start Conversion Finished In this example, we show you how to use DataStorm to…
🌐
LambdaTest
lambdatest.com › home › free tools › xml to json converter
XML to JSON Converter Online | Free XML to JSON Tool
When a document is converted from XML to JSON, element attributes that exist in the XML document will be changed to properties. In the converted JSON document, elements that appear several times in the XML document will be changed to an array of objects. There are two approaches to converting XML to JSON data: using External Libraries or leveraging free online XML to JSON convertor.