You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Robert Middleton <rm...@apache.org> on 2021/04/17 02:31:06 UTC

[log4cxx] XML configuration with compression

Does anybody happen to have a known good XML file for rollover with
compression?  I'm working on LOGCXX-523 and I'm trying to configure
the XML file to gzip the files when rolling over, but I can't get it
to work.  It seems that the only configuration that we have in the
tests programmatically configures it, so I'm not sure if it actually
works when it's configured from the file or not.

-Robrt Middleton

Re: [log4cxx] XML configuration with compression

Posted by Robert Middleton <rm...@apache.org>.
> > The quirky thing about this is that because log4cxx doesn't actually
> > care about the Java class name, the following lines in the config file
> > are all equivalent:
> > <appender name="ROLL"
> > class="org.apache.log4j.rolling.RollingFileAppender">
> > <appender name="ROLL" class="RollingFileAppender">
> > <appender name="ROLL" class="log4cxx.RollingFileAppender">
>
> I don't get your point: The second and third line could be used to
> address the wrong RollingFileAppender currently, the obsolete one?
> Looking at the class loader, the absolute name is preferred, so NOT
> using those names for appenders could easily be considered a user
> error or docs would need to be made more clear.
>

All of those configuration lines load the correct version of
RollingFileAppender.  The meta-data about the class(in the
DECLARE_LOG4CXX_OBJECT macro) contains the class name.  For the
non-obsolete version, the class name is simply "RollingFileAppender".
The obsolete version is defined here:
https://github.com/apache/logging-log4cxx/blob/79352bd0160866d06b61414f2dc83d1f71b44335/src/main/cpp/obsoleterollingfileappender.cpp#L40

If the exact class name isn't found, then the code simply looks at
everything beyond the last '.' to load the class:
https://github.com/apache/logging-log4cxx/blob/79352bd0160866d06b61414f2dc83d1f71b44335/src/main/cpp/class.cpp#L123
Since all of the examples that I gave end in 'RollingFileAppender' and
they don't equal "org.apache.log4j.RollingFileAppender", the correct
RollingFileAppender is used.

-Robert Middleton

Re: [log4cxx] XML configuration with compression

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Robert Middleton,
am Sonntag, 18. April 2021 um 01:08 schrieben Sie:

> This loads the obsolete rolling file appender for log4cxx, which
> doesn't seem to work properly.  It certainly doesn't work correctly
> for the test that I've been trying to do.

"org.apache.log4j.rolling.RollingFileAppender" does work as documented
with compression in your test?

> As the name would suggest,
> it's probably obsolete and we should think about removing it post
> 0.12.

Makes totally sense to me for 0.13, which might break compatibility
again because of ABI-checks already.

> The quirky thing about this is that because log4cxx doesn't actually
> care about the Java class name, the following lines in the config file
> are all equivalent:
> <appender name="ROLL"
> class="org.apache.log4j.rolling.RollingFileAppender">
> <appender name="ROLL" class="RollingFileAppender">
> <appender name="ROLL" class="log4cxx.RollingFileAppender">

I don't get your point: The second and third line could be used to
address the wrong RollingFileAppender currently, the obsolete one?
Looking at the class loader, the absolute name is preferred, so NOT
using those names for appenders could easily be considered a user
error or docs would need to be made more clear.

Besides that, with removing the obsolte RollingFileAppender, the above
config might even work for some users with the correct one now?

Mit freundlichen Grüßen

Thorsten Schöning

-- 
AM-SoFT IT-Service - Bitstore Hameln GmbH i.G.
Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK

E-Mail: Thorsten.Schoening@AM-SoFT.de
Web:    http://www.AM-SoFT.de/

Tel:   05151-  9468- 0
Tel:   05151-  9468-55
Fax:   05151-  9468-88
Mobil:  0178-8 9468-04

AM-SoFT IT-Service - Bitstore Hameln GmbH i.G., Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB neu - Geschäftsführer: Janine Galonska


Für Rückfragen stehe ich Ihnen sehr gerne zur Verfügung.

Mit freundlichen Grüßen

Thorsten Schöning


Tel: 05151 9468 0
Fax: 05151 9468 88
Mobil: 
Webseite: https://www.am-soft.de 

AM-Soft IT-Service - Bitstore Hameln GmbH i.G. ist ein Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK

AM-Soft IT-Service - Bitstore Hameln GmbH i.G.
Brandenburger Str. 7c
31789 Hameln
Tel: 05151 9468 0

Bitstore IT-Consulting GmbH
Zentrale - Berlin Lichtenberg
Frankfurter Allee 285
10317 Berlin
Tel: 030 453 087 80

CBS IT-Service - Bitstore Kaulsdorf UG
Tel: 030 453 087 880 1

Büro Dallgow-Döberitz
Tel: 03322 507 020

Büro Kloster Lehnin
Tel: 033207 566 530

PCE IT-Service - Bitstore Darmstadt UG
Darmstadt
Tel: 06151 392 973 0

Büro Neuruppin
Tel: 033932 606 090

ACI EDV Systemhaus - Bitstore Dresden GmbH
Dresden
Tel: 0351 254 410

Das Systemhaus - Bitstore Magdeburg GmbH
Magdeburg
Tel: 0391 636 651 0

Allerdata.IT - Bitstore Wittenberg GmbH
Wittenberg
Tel: 03491 876 735 7

Büro Liebenwalde
Tel: 033054 810 00

HSA - das Büro - Bitstore Altenburg UG
Altenburg
Tel: 0344 784 390 97

Bitstore IT – Consulting GmbH
NL Piesteritz 
Piesteritz
Tel: 03491 644 868 6

Solltec IT-Services - Bitstore Braunschweig UG
Braunschweig
Tel: 0531 206 068 0

MF Computer Service - Bitstore Gütersloh GmbH
Gütersloh
Tel: 05245 920 809 3

Firmensitz: AM-Soft IT-Service - Bitstore Hameln GmbH i.G. , Brandenburger Str. 7c , 31789 Hameln
Geschäftsführer Janine Galonska







Re: [log4cxx] XML configuration with compression

Posted by Robert Middleton <rm...@apache.org>.
So there is apparently a difference between having your config
appender being org.apache.log4j.rolling.RollingFileAppender vs.
org.apache.log4j.RollingFileAppender.  The second one(which doesn't
have the extra 'rolling' in its namespace) will only be activated if
you have /exactly/ the following in your config file:
<appender name="ROLL" class="org.apache.log4j.RollingFileAppender">
This loads the obsolete rolling file appender for log4cxx, which
doesn't seem to work properly.  It certainly doesn't work correctly
for the test that I've been trying to do.  As the name would suggest,
it's probably obsolete and we should think about removing it post
0.12.

The quirky thing about this is that because log4cxx doesn't actually
care about the Java class name, the following lines in the config file
are all equivalent:
<appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
<appender name="ROLL" class="RollingFileAppender">
<appender name="ROLL" class="log4cxx.RollingFileAppender">

-Robert Middleton

On Sat, Apr 17, 2021 at 4:27 AM Thorsten Schöning <ts...@am-soft.de> wrote:
>
> Guten Tag Robert Middleton,
> am Samstag, 17. April 2021 um 04:31 schrieben Sie:
>
> > Does anybody happen to have a known good XML file for rollover with
> > compression?  I'm working on LOGCXX-523 and I'm trying to configure
> > the XML file to gzip the files when rolling over, but I can't get it
> > to work.[...]
>
> What did you try so for? RollingFileAppender has an example
> documented, if that doesn't work, that should be changed as well.
>
> https://svn.apache.org/repos/asf/logging/site/trunk/docs/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1_rolling_file_appender.html
>
> Might just have been copied&pasted from log4j in the past:
>
> https://stackoverflow.com/questions/19616641/log4j-configurations-with-daily-rolling-gzip-and-max-backup-files
>
> Mit freundlichen Grüßen
>
> Thorsten Schöning
>
> --
> AM-SoFT IT-Service - Bitstore Hameln GmbH i.G.
> Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK
>
> E-Mail: Thorsten.Schoening@AM-SoFT.de
> Web:    http://www.AM-SoFT.de/
>
> Tel:   05151-  9468- 0
> Tel:   05151-  9468-55
> Fax:   05151-  9468-88
> Mobil:  0178-8 9468-04
>
> AM-SoFT IT-Service - Bitstore Hameln GmbH i.G., Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB neu - Geschäftsführer: Janine Galonska
>
>
> Für Rückfragen stehe ich Ihnen sehr gerne zur Verfügung.
>
> Mit freundlichen Grüßen
>
> Thorsten Schöning
>
>
> Tel: 05151 9468 0
> Fax: 05151 9468 88
> Mobil:
> Webseite: https://www.am-soft.de
>
> AM-Soft IT-Service - Bitstore Hameln GmbH i.G. ist ein Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK
>
> AM-Soft IT-Service - Bitstore Hameln GmbH i.G.
> Brandenburger Str. 7c
> 31789 Hameln
> Tel: 05151 9468 0
>
> Bitstore IT-Consulting GmbH
> Zentrale - Berlin Lichtenberg
> Frankfurter Allee 285
> 10317 Berlin
> Tel: 030 453 087 80
>
> CBS IT-Service - Bitstore Kaulsdorf UG
> Tel: 030 453 087 880 1
>
> Büro Dallgow-Döberitz
> Tel: 03322 507 020
>
> Büro Kloster Lehnin
> Tel: 033207 566 530
>
> PCE IT-Service - Bitstore Darmstadt UG
> Darmstadt
> Tel: 06151 392 973 0
>
> Büro Neuruppin
> Tel: 033932 606 090
>
> ACI EDV Systemhaus - Bitstore Dresden GmbH
> Dresden
> Tel: 0351 254 410
>
> Das Systemhaus - Bitstore Magdeburg GmbH
> Magdeburg
> Tel: 0391 636 651 0
>
> Allerdata.IT - Bitstore Wittenberg GmbH
> Wittenberg
> Tel: 03491 876 735 7
>
> Büro Liebenwalde
> Tel: 033054 810 00
>
> HSA - das Büro - Bitstore Altenburg UG
> Altenburg
> Tel: 0344 784 390 97
>
> Bitstore IT – Consulting GmbH
> NL Piesteritz
> Piesteritz
> Tel: 03491 644 868 6
>
> Solltec IT-Services - Bitstore Braunschweig UG
> Braunschweig
> Tel: 0531 206 068 0
>
> MF Computer Service - Bitstore Gütersloh GmbH
> Gütersloh
> Tel: 05245 920 809 3
>
> Firmensitz: AM-Soft IT-Service - Bitstore Hameln GmbH i.G. , Brandenburger Str. 7c , 31789 Hameln
> Geschäftsführer Janine Galonska
>
>
>
>
>
>

Re: [log4cxx] XML configuration with compression

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Robert Middleton,
am Samstag, 17. April 2021 um 04:31 schrieben Sie:

> Does anybody happen to have a known good XML file for rollover with
> compression?  I'm working on LOGCXX-523 and I'm trying to configure
> the XML file to gzip the files when rolling over, but I can't get it
> to work.[...]

What did you try so for? RollingFileAppender has an example
documented, if that doesn't work, that should be changed as well.

https://svn.apache.org/repos/asf/logging/site/trunk/docs/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1_rolling_file_appender.html

Might just have been copied&pasted from log4j in the past:

https://stackoverflow.com/questions/19616641/log4j-configurations-with-daily-rolling-gzip-and-max-backup-files

Mit freundlichen Grüßen

Thorsten Schöning

-- 
AM-SoFT IT-Service - Bitstore Hameln GmbH i.G.
Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK

E-Mail: Thorsten.Schoening@AM-SoFT.de
Web:    http://www.AM-SoFT.de/

Tel:   05151-  9468- 0
Tel:   05151-  9468-55
Fax:   05151-  9468-88
Mobil:  0178-8 9468-04

AM-SoFT IT-Service - Bitstore Hameln GmbH i.G., Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB neu - Geschäftsführer: Janine Galonska


Für Rückfragen stehe ich Ihnen sehr gerne zur Verfügung.

Mit freundlichen Grüßen

Thorsten Schöning


Tel: 05151 9468 0
Fax: 05151 9468 88
Mobil: 
Webseite: https://www.am-soft.de 

AM-Soft IT-Service - Bitstore Hameln GmbH i.G. ist ein Mitglied der Bitstore Gruppe - Ihr Full-Service-Dienstleister für IT und TK

AM-Soft IT-Service - Bitstore Hameln GmbH i.G.
Brandenburger Str. 7c
31789 Hameln
Tel: 05151 9468 0

Bitstore IT-Consulting GmbH
Zentrale - Berlin Lichtenberg
Frankfurter Allee 285
10317 Berlin
Tel: 030 453 087 80

CBS IT-Service - Bitstore Kaulsdorf UG
Tel: 030 453 087 880 1

Büro Dallgow-Döberitz
Tel: 03322 507 020

Büro Kloster Lehnin
Tel: 033207 566 530

PCE IT-Service - Bitstore Darmstadt UG
Darmstadt
Tel: 06151 392 973 0

Büro Neuruppin
Tel: 033932 606 090

ACI EDV Systemhaus - Bitstore Dresden GmbH
Dresden
Tel: 0351 254 410

Das Systemhaus - Bitstore Magdeburg GmbH
Magdeburg
Tel: 0391 636 651 0

Allerdata.IT - Bitstore Wittenberg GmbH
Wittenberg
Tel: 03491 876 735 7

Büro Liebenwalde
Tel: 033054 810 00

HSA - das Büro - Bitstore Altenburg UG
Altenburg
Tel: 0344 784 390 97

Bitstore IT – Consulting GmbH
NL Piesteritz 
Piesteritz
Tel: 03491 644 868 6

Solltec IT-Services - Bitstore Braunschweig UG
Braunschweig
Tel: 0531 206 068 0

MF Computer Service - Bitstore Gütersloh GmbH
Gütersloh
Tel: 05245 920 809 3

Firmensitz: AM-Soft IT-Service - Bitstore Hameln GmbH i.G. , Brandenburger Str. 7c , 31789 Hameln
Geschäftsführer Janine Galonska