You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Fröstl, Christian <ch...@accenture.com> on 2018/08/06 12:55:33 UTC

Log4j2 - combining .properties and .xml config files

Hi everybody,

I just wanted to know if it is planned to combine different logging configuration in the future, or if it is still possible today?

Example:
- Base logging configuration is a log4j2.xml from the classpath
- Logging could be extended by adding new loggers to the .properties files

Could this be a valid case in the future of log4j2 or is there a strict separation between .properties and .xml files? (or even properties and JSON files)

Thanks and greetings,
Christian


________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com

Re: [External] Log4j2 - combining .properties and .xml config files

Posted by Fröstl, Christian <ch...@accenture.com>.
Hi,

We are using hybris with log4j2 and in hybris we have to set log4j2.config.xml in order to use the xml configuration from log4j2.
I like to combine properties and xml config both in hybris. Do you have any ideas how to get this running?

Greetings

On 16.08.18, 16:06, "Ralph Goers" <ra...@dslextreme.com> wrote:

    I don’t understand what you are trying to do here. Why do you have both log4j2.configurationFile and log4j.configurationFile? Only one of them will take effect. What is log4j2.config.xml? Last I checked, Log4j2 doesn’t have a property with that name.
    
    I thought you were asking about composite configurations but I don’t see you trying to do that here.
    
    Ralph
    
    > On Aug 16, 2018, at 5:11 AM, Fröstl, Christian <ch...@accenture.com> wrote:
    > 
    > Unfortunately, I am not able to configure it. I tried the following configuration in our properties file:
    > log4j2.configurationFile=/<path-to-file>/log4j2.xml,/<path-to-file>/local-55.properties
    > log4j.configurationFile=/<path-to-file>/log4j2.xml,/<path-to-file>/local-55.properties
    > 
    > The log4j2.xml will only be used if I activate this parameter in the property file:
    > log4j2.config.xml=hybris-log4j2.xml
    > 
    > Both configurations are working correctly, if I just use it directly in the property file or if I activate the xml config with the log4j2.config.xml parameter.
    > Even if I only try to load the properties file, it will not be used. Instead, the default logging will be used.
    > 
    > Example:
    > log4j2.configurationFile=/path-to-file>/local-55.properties
    > log4j.configurationFile=/path-to-file>/local-55.properties
    > 
    > Greetings,
    > Christian
    > 
    > On 06.08.18, 15:26, "Ralph Goers" <ralph.goers@dslextreme.com <ma...@dslextreme.com>> wrote:
    > 
    >    You can do this today. See https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e= <https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e=> <https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e= <https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e=>>.
    > 
    >> On Aug 6, 2018, at 5:55 AM, Fröstl, Christian <ch...@accenture.com> wrote:
    >> 
    >> Hi everybody,
    >> 
    >> I just wanted to know if it is planned to combine different logging configuration in the future, or if it is still possible today?
    >> 
    >> Example:
    >> - Base logging configuration is a log4j2.xml from the classpath
    >> - Logging could be extended by adding new loggers to the .properties files
    >> 
    >> Could this be a valid case in the future of log4j2 or is there a strict separation between .properties and .xml files? (or even properties and JSON files)
    >> 
    >> Thanks and greetings,
    >> Christian
    >> 
    >> 
    >> ________________________________
    >> 
    >> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
    >> ______________________________________________________________________________________
    >> 
    >> www.accenture.com
    >> 
    >> ---------------------------------------------------------------------
    >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
    >> For additional commands, e-mail: log4j-user-help@logging.apache.org
    >> 
    > 
    > 
    > 
    > 
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org <ma...@logging.apache.org>
    > For additional commands, e-mail: log4j-user-help@logging.apache.org <ma...@logging.apache.org>
    


Re: [External] Log4j2 - combining .properties and .xml config files

Posted by Ralph Goers <ra...@dslextreme.com>.
I don’t understand what you are trying to do here. Why do you have both log4j2.configurationFile and log4j.configurationFile? Only one of them will take effect. What is log4j2.config.xml? Last I checked, Log4j2 doesn’t have a property with that name.

I thought you were asking about composite configurations but I don’t see you trying to do that here.

Ralph

> On Aug 16, 2018, at 5:11 AM, Fröstl, Christian <ch...@accenture.com> wrote:
> 
> Unfortunately, I am not able to configure it. I tried the following configuration in our properties file:
> log4j2.configurationFile=/<path-to-file>/log4j2.xml,/<path-to-file>/local-55.properties
> log4j.configurationFile=/<path-to-file>/log4j2.xml,/<path-to-file>/local-55.properties
> 
> The log4j2.xml will only be used if I activate this parameter in the property file:
> log4j2.config.xml=hybris-log4j2.xml
> 
> Both configurations are working correctly, if I just use it directly in the property file or if I activate the xml config with the log4j2.config.xml parameter.
> Even if I only try to load the properties file, it will not be used. Instead, the default logging will be used.
> 
> Example:
> log4j2.configurationFile=/path-to-file>/local-55.properties
> log4j.configurationFile=/path-to-file>/local-55.properties
> 
> Greetings,
> Christian
> 
> On 06.08.18, 15:26, "Ralph Goers" <ralph.goers@dslextreme.com <ma...@dslextreme.com>> wrote:
> 
>    You can do this today. See https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e= <https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e=> <https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e= <https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e=>>.
> 
>> On Aug 6, 2018, at 5:55 AM, Fröstl, Christian <ch...@accenture.com> wrote:
>> 
>> Hi everybody,
>> 
>> I just wanted to know if it is planned to combine different logging configuration in the future, or if it is still possible today?
>> 
>> Example:
>> - Base logging configuration is a log4j2.xml from the classpath
>> - Logging could be extended by adding new loggers to the .properties files
>> 
>> Could this be a valid case in the future of log4j2 or is there a strict separation between .properties and .xml files? (or even properties and JSON files)
>> 
>> Thanks and greetings,
>> Christian
>> 
>> 
>> ________________________________
>> 
>> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
>> ______________________________________________________________________________________
>> 
>> www.accenture.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org <ma...@logging.apache.org>
> For additional commands, e-mail: log4j-user-help@logging.apache.org <ma...@logging.apache.org>

Re: [External] Re: Log4j2 - combining .properties and .xml config files

Posted by Fröstl, Christian <ch...@accenture.com>.
Unfortunately, I am not able to configure it. I tried the following configuration in our properties file:
log4j2.configurationFile=/<path-to-file>/log4j2.xml,/<path-to-file>/local-55.properties
log4j.configurationFile=/<path-to-file>/log4j2.xml,/<path-to-file>/local-55.properties

The log4j2.xml will only be used if I activate this parameter in the property file:
log4j2.config.xml=hybris-log4j2.xml

Both configurations are working correctly, if I just use it directly in the property file or if I activate the xml config with the log4j2.config.xml parameter.
Even if I only try to load the properties file, it will not be used. Instead, the default logging will be used.

Example:
log4j2.configurationFile=/path-to-file>/local-55.properties
log4j.configurationFile=/path-to-file>/local-55.properties

Greetings,
Christian

On 06.08.18, 15:26, "Ralph Goers" <ra...@dslextreme.com> wrote:

    You can do this today. See https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e= <https://urldefense.proofpoint.com/v2/url?u=http-3A__logging.apache.org_log4j_2.x_manual_configuration.html-23CompositeConfiguration&d=DwIFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=37nF0SnGtdjmcblOpYG7cKwaPDc1GWo5GNDvnDLF8TE&m=dqVUgBVu7URniCVxTeq1y5U_d6Fn7acMLpIQqhd-Vhs&s=1jWwqr_hAMgBAQrr8zFcuOLEPViYbVW7eF0WssQfO2E&e=>.
    
    > On Aug 6, 2018, at 5:55 AM, Fröstl, Christian <ch...@accenture.com> wrote:
    > 
    > Hi everybody,
    > 
    > I just wanted to know if it is planned to combine different logging configuration in the future, or if it is still possible today?
    > 
    > Example:
    > - Base logging configuration is a log4j2.xml from the classpath
    > - Logging could be extended by adding new loggers to the .properties files
    > 
    > Could this be a valid case in the future of log4j2 or is there a strict separation between .properties and .xml files? (or even properties and JSON files)
    > 
    > Thanks and greetings,
    > Christian
    > 
    > 
    > ________________________________
    > 
    > This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
    > ______________________________________________________________________________________
    > 
    > www.accenture.com
    > 
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
    > For additional commands, e-mail: log4j-user-help@logging.apache.org
    > 
    
    


Re: Log4j2 - combining .properties and .xml config files

Posted by Ralph Goers <ra...@dslextreme.com>.
You can do this today. See http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration <http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration>.

> On Aug 6, 2018, at 5:55 AM, Fröstl, Christian <ch...@accenture.com> wrote:
> 
> Hi everybody,
> 
> I just wanted to know if it is planned to combine different logging configuration in the future, or if it is still possible today?
> 
> Example:
> - Base logging configuration is a log4j2.xml from the classpath
> - Logging could be extended by adding new loggers to the .properties files
> 
> Could this be a valid case in the future of log4j2 or is there a strict separation between .properties and .xml files? (or even properties and JSON files)
> 
> Thanks and greetings,
> Christian
> 
> 
> ________________________________
> 
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
> ______________________________________________________________________________________
> 
> www.accenture.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


Re: Log4j2 - combining .properties and .xml config files

Posted by Ralph Goers <ra...@dslextreme.com>.
You can do this today. See http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration <http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration>.

> On Aug 6, 2018, at 5:55 AM, Fröstl, Christian <ch...@accenture.com> wrote:
> 
> Hi everybody,
> 
> I just wanted to know if it is planned to combine different logging configuration in the future, or if it is still possible today?
> 
> Example:
> - Base logging configuration is a log4j2.xml from the classpath
> - Logging could be extended by adding new loggers to the .properties files
> 
> Could this be a valid case in the future of log4j2 or is there a strict separation between .properties and .xml files? (or even properties and JSON files)
> 
> Thanks and greetings,
> Christian
> 
> 
> ________________________________
> 
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
> ______________________________________________________________________________________
> 
> www.accenture.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>