You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by jyothi <jy...@promantia.com> on 2017/12/13 06:05:25 UTC

custom log file size not restricted

Hi,

I have configured for a custom log in pax logging in Karaf as follows and
found the size of the custom log is not restricted to 1 MB and increasing.
Can you please let us know what could be the issue? Thanks in advance

log4j.appender.custom = org.apache.log4j.RollingFileAppender
log4j.appender.custom.append = true
log4j.appender.custom.file = ${karaf.data}/log/custom.log
log4j.appender.custom.layout = org.apache.log4j.PatternLayout
log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
%-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
%m%n
log4j.appender.custom.maxBackupIndex = 10
log4j.appender.custom.maxFileSize = 1MB




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Thank you so much JB!!



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jyothi,

I have a local branch with the fix in Pax Logging. I will prepare a release to 
be able to update in Karaf.

I keep you posted.

Regards
JB

On 01/04/2018 05:30 AM, jyothi wrote:
> Hi JB!!
> 
> Sorry for disturbing you frequently on this !!
> 
> Please let me know if I can track of this JIRA issue?
> 
> Regards,
> Jyothi.
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB!!

Sorry for disturbing you frequently on this !! 

Please let me know if I can track of this JIRA issue?

Regards,
Jyothi.



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

not yet, I will create the Jira and work on it today.

Sorry about the delay.

Regards
JB

On 12/22/2017 06:09 AM, jyothi wrote:
> Hi JB!!
> 
> Can we know if you got a chance to check the spaces issue in Pax Logging?
> 
> Thanks & Regards,
> Jyothi.
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB!!

Can we know if you got a chance to check the spaces issue in Pax Logging?

Thanks & Regards,
Jyothi.




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jyothi

Actually, there's two things:

1. Pax Logging should trim extra space
2. The config:* commands should not add extra spaces ;)

So, let me check for both ;)

Regards
JB

On 12/15/2017 08:26 AM, jyothi wrote:
> Hi JB!!
> 
> When we removed spaces it worked!! Thanks for that.
> 
> But the config file content is generated using below script or ConfigMBean
> update method.Can you please tell how can we remove the spaces without
> manual action?
> 
> Ex:
> config:edit org.ops4j.pax.logging
> config:property-set log4j.appender.custom.file
> '${karaf.data}/log/custom.log'
> config:property-set log4j.appender.custom.append true
> config:property-set log4j.appender.custom.maxFileSize 1MB
> config:property-set log4j.appender.custom.maxBackupIndex 10
> config:update
> 
> Thanks & Regards,
> Jyothi
> 
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB!!

When we removed spaces it worked!! Thanks for that.

But the config file content is generated using below script or ConfigMBean
update method.Can you please tell how can we remove the spaces without
manual action?

Ex:
config:edit org.ops4j.pax.logging
config:property-set log4j.appender.custom.file
'${karaf.data}/log/custom.log'
config:property-set log4j.appender.custom.append true
config:property-set log4j.appender.custom.maxFileSize 1MB
config:property-set log4j.appender.custom.maxBackupIndex 10
config:update

Thanks & Regards,
Jyothi





--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
OK, understood. So let me try with 4.0.5 then.

Regards
JB

On 01/30/2018 08:25 AM, jyothi wrote:
> JB, Unfortunately this issue is happening on one instance of Client
> environment , where I can't check with other versions. I couldn't reproduce
> it in our local windows environment  to check with latest version and be
> certain that its working with latest version.
> 
> Also, there is no flexibility for us to Upgrade Karaf with other versions as
> it is already distributed in multiple instances.
> 
> Thanks,
> Jyothi
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
JB, Unfortunately this issue is happening on one instance of Client
environment , where I can't check with other versions. I couldn't reproduce
it in our local windows environment  to check with latest version and be
certain that its working with latest version.

Also, there is no flexibility for us to Upgrade Karaf with other versions as
it is already distributed in multiple instances.

Thanks,
Jyothi



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Can you please test with 4.0.10 (I will do it anyway) as we updated Pax Logging
version ?

Thanks,
Regards
JB

On 01/30/2018 08:03 AM, jyothi wrote:
> Working with Karaf 4.0.5. Didn't work on other versions.
> 
> Tested with appender to the root logger and also removing spaces. It worked
> when removing spaces. But spaces are coming from Karaf script like below.
> 
> config:edit org.ops4j.pax.logging
> config:property-set log4j.appender.custom.file
> '${karaf.data}/log/custom.log'
> config:property-set log4j.appender.custom.append true
> config:property-set log4j.appender.custom.maxFileSize 1MB
> config:property-set log4j.appender.custom.maxBackupIndex 10
> config:update 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Working with Karaf 4.0.5. Didn't work on other versions.

Tested with appender to the root logger and also removing spaces. It worked
when removing spaces. But spaces are coming from Karaf script like below.

config:edit org.ops4j.pax.logging
config:property-set log4j.appender.custom.file
'${karaf.data}/log/custom.log'
config:property-set log4j.appender.custom.append true
config:property-set log4j.appender.custom.maxFileSize 1MB
config:property-set log4j.appender.custom.maxBackupIndex 10
config:update 



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

Does it work if you add the appender to the rootLogger ?

Did you try with latest 4.0.10 ?

Regards
JB

On 01/30/2018 07:47 AM, jyothi wrote:
> Hi JB,
> 
> Sorry couldn't mail, please find the complete pax logging file here and as
> said this issue is in Windows environment
> 
> 
> # Root logger
> log4j.rootLogger = INFO, out, osgi:*
> log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
> 
> # Security audit logger
> log4j.logger.org.apache.karaf.jaas.modules.audit=INFO, audit
> log4j.additivity.org.apache.karaf.jaas.modules.audit=false
> 
> # CONSOLE appender not used by default
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
> %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
> %X{bundle.version} | %m%n
> 
> # File appender
> log4j.appender.out=org.apache.log4j.RollingFileAppender
> log4j.appender.out.layout=org.apache.log4j.PatternLayout
> log4j.appender.out.layout.ConversionPattern = %d{ISO8601} | %-5.5p | %t |
> %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
> log4j.appender.out.file=${karaf.data}/log/karaf.log
> log4j.appender.out.append=true
> log4j.appender.out.maxFileSize=1MB
> log4j.appender.out.maxBackupIndex=10
> 
> # Audit appender
> log4j.appender.audit=org.apache.log4j.RollingFileAppender
> log4j.appender.audit.layout=org.apache.log4j.PatternLayout
> log4j.appender.audit.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
> %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
> %X{bundle.version} | %m%n
> log4j.appender.audit.file=${karaf.data}/security/audit.log
> log4j.appender.audit.append=true
> log4j.appender.audit.maxFileSize=1MB
> log4j.appender.audit.maxBackupIndex=10
> 
> # Sift appender
> log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
> log4j.appender.sift.key=bundle.name
> log4j.appender.sift.default=karaf
> log4j.appender.sift.appender=org.apache.log4j.FileAppender
> log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
> log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
> %-16.16t | %-32.32c{1} | %m%n
> log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
> log4j.appender.sift.appender.append=true
> log4j.category.org.apache.commons.scxml2.env.SimpleSCXMLListener = WARN
> log4j.appender.custom = org.apache.log4j.RollingFileAppender
> log4j.appender.custom.append = true
> log4j.appender.custom.file = ${karaf.data}/log/userLog.log
> log4j.appender.custom.layout = org.apache.log4j.PatternLayout
> log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
> %-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
> %m%n
> log4j.appender.custom.maxBackupIndex = 10
> log4j.appender.custom.maxFileSize = 1MB
> log4j.logger.com.test.exception = INFO,custom
> log4j.logger.com.test.logger = INFO,custom
> 
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB,

Sorry couldn't mail, please find the complete pax logging file here and as
said this issue is in Windows environment


# Root logger
log4j.rootLogger = INFO, out, osgi:*
log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer

# Security audit logger
log4j.logger.org.apache.karaf.jaas.modules.audit=INFO, audit
log4j.additivity.org.apache.karaf.jaas.modules.audit=false

# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
%-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
%X{bundle.version} | %m%n

# File appender
log4j.appender.out=org.apache.log4j.RollingFileAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern = %d{ISO8601} | %-5.5p | %t |
%c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
log4j.appender.out.file=${karaf.data}/log/karaf.log
log4j.appender.out.append=true
log4j.appender.out.maxFileSize=1MB
log4j.appender.out.maxBackupIndex=10

# Audit appender
log4j.appender.audit=org.apache.log4j.RollingFileAppender
log4j.appender.audit.layout=org.apache.log4j.PatternLayout
log4j.appender.audit.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
%-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
%X{bundle.version} | %m%n
log4j.appender.audit.file=${karaf.data}/security/audit.log
log4j.appender.audit.append=true
log4j.appender.audit.maxFileSize=1MB
log4j.appender.audit.maxBackupIndex=10

# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=karaf
log4j.appender.sift.appender=org.apache.log4j.FileAppender
log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
%-16.16t | %-32.32c{1} | %m%n
log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true
log4j.category.org.apache.commons.scxml2.env.SimpleSCXMLListener = WARN
log4j.appender.custom = org.apache.log4j.RollingFileAppender
log4j.appender.custom.append = true
log4j.appender.custom.file = ${karaf.data}/log/userLog.log
log4j.appender.custom.layout = org.apache.log4j.PatternLayout
log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
%-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
%m%n
log4j.appender.custom.maxBackupIndex = 10
log4j.appender.custom.maxFileSize = 1MB
log4j.logger.com.test.exception = INFO,custom
log4j.logger.com.test.logger = INFO,custom





--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB!!

Mailed you the pax logging file and this issue is reproducible in Windows
environment.

Regards,
Jyothi



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Can you send the complete org.ops4j.pax.logging.cfg ?

What's your OS ?

Thanks,
Regards
JB

On 01/30/2018 06:01 AM, jyothi wrote:
> Hi JB,
> 
> Please find the attached image, where user log is not restricted to 1MB with
> below config in Pax Logging. Can you please suggest us on this if spaces are
> not an issue?
> 
> log4j.appender.custom = org.apache.log4j.RollingFileAppender
> log4j.appender.custom.append = true
> log4j.appender.custom.file = ${karaf.data}/log/userLog.log
> log4j.appender.custom.layout = org.apache.log4j.PatternLayout
> log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
> %-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
> %m%n
> log4j.appender.custom.maxBackupIndex = 10
> log4j.appender.custom.maxFileSize = 1MB
> log4j.logger.com.exception = INFO,custom
> log4j.logger.com.logger = INFO,custom
> 
> Thanks & Regards,
> Jyothi
> <http://karaf.922171.n3.nabble.com/file/t497873/304e50db-7e19-4e90-9e02-79d3f85acb26.jpg> 
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB,

Please find the attached image, where user log is not restricted to 1MB with
below config in Pax Logging. Can you please suggest us on this if spaces are
not an issue?

log4j.appender.custom = org.apache.log4j.RollingFileAppender
log4j.appender.custom.append = true
log4j.appender.custom.file = ${karaf.data}/log/userLog.log
log4j.appender.custom.layout = org.apache.log4j.PatternLayout
log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
%-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
%m%n
log4j.appender.custom.maxBackupIndex = 10
log4j.appender.custom.maxFileSize = 1MB
log4j.logger.com.exception = INFO,custom
log4j.logger.com.logger = INFO,custom

Thanks & Regards,
Jyothi
<http://karaf.922171.n3.nabble.com/file/t497873/304e50db-7e19-4e90-9e02-79d3f85acb26.jpg> 




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Sorry for the delay.. Back from vacation !!

Configuring appender in this way in pom and importing org.apache.log4j in
<Import-Package>. Please let me know if I answered you properly 

   <dependency>
     <groupId>org.ops4j.pax.logging</groupId>
     <artifactId>pax-logging-service</artifactId>
     <version>1.8.4</version>
     <scope>provided</scope>
   </dependency>
   <dependency>
     <groupId>org.ops4j.pax.logging</groupId>
     <artifactId>pax-logging-api</artifactId>
     <version>1.8.4</version>
     <scope>provided</scope>
   </dependency>



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
You need to add the appender to a logger (rootLogger or specific one).

Can you share how you "call" the appender ?

Regards
JB

On 01/10/2018 01:29 AM, jyothi wrote:
> Hi,
> 
>   I didn't add custom to rootLogger.Do I need to add it?
> 
> Yes I restarted Karaf after the changes and this issue happened only on two
> machines and not reproduced in other machines.
> 
> Thanks,
> Jyothi.
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi,

 I didn't add custom to rootLogger.Do I need to add it?

Yes I restarted Karaf after the changes and this issue happened only on two
machines and not reproduced in other machines.

Thanks,
Jyothi.



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hmmm, it works fine on my box using 4.0.5 using the following config:

log4j.rootLogger=DEBUG, out, custom, osgi:*

...

log4j.appender.custom = org.apache.log4j.RollingFileAppender
log4j.appender.custom.append = true
log4j.appender.custom.file = ${karaf.data}/log/custom.log
log4j.appender.custom.layout = org.apache.log4j.PatternLayout
log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} | 
%-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
%m%n
log4j.appender.custom.maxBackupIndex = 10
log4j.appender.custom.maxFileSize = 1KB

Dump question: when you changed org.ops4j.pax.logging configuration (via the 
shell commands), did you restart the pax-logging service or Karaf ?

Regards
JB

On 01/09/2018 04:27 PM, Jean-Baptiste Onofré wrote:
> Hi Jyothi,
> 
> I just tested with Karaf 4.0.11-SNAPSHOT and it works fine (using or not space).
> 
> Let me try with Karaf 4.0.5.
> 
> Regards
> JB
> 
> On 12/14/2017 06:04 AM, jyothi wrote:
>> Hi JB!!
>>
>> We are using karaf-4.0.5.
>>
>> Thanks & Regards,
>> Jyothi.
>>
>>
>>
>> -- 
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>>
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jyothi,

I just tested with Karaf 4.0.11-SNAPSHOT and it works fine (using or not space).

Let me try with Karaf 4.0.5.

Regards
JB

On 12/14/2017 06:04 AM, jyothi wrote:
> Hi JB!!
> 
> We are using karaf-4.0.5.
> 
> Thanks & Regards,
> Jyothi.
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB!!

We are using karaf-4.0.5.

Thanks & Regards,
Jyothi.



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

your configuration looks good to me.

Yes, please try to remove extra space first.

By the way, what's the Karaf version (I guess 4.0.x regarding your cfg file) ?
As reminder, Karaf 4.0.x uses log4j 1.x configuration style, and from Karaf 
4.1.x, we are using log4j 2.x style.

Regards
JB

On 12/13/2017 12:42 PM, jyothi wrote:
> Hi JB,
> 
> Thanks for the quick response!!
> 
> Regarding spaces, that is generated one using config:property-append from
> Karaf console. I will try to remove spaces and check if it works!!
> 
> Please find my complete pax logging config and I didn't added anything to
> rootLogger. Do I need to add custom to the log4j.rootLogger?
> 
> # Root logger
> log4j.rootLogger = INFO, out, osgi:*
> log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
> 
> # Security audit logger
> log4j.logger.org.apache.karaf.jaas.modules.audit=INFO, audit
> log4j.additivity.org.apache.karaf.jaas.modules.audit=false
> 
> # CONSOLE appender not used by default
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
> %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
> %X{bundle.version} | %m%n
> 
> # File appender
> log4j.appender.out=org.apache.log4j.RollingFileAppender
> log4j.appender.out.layout=org.apache.log4j.PatternLayout
> log4j.appender.out.layout.ConversionPattern = %d{ISO8601} | %-5.5p | %t |
> %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
> log4j.appender.out.file=${karaf.data}/log/karaf.log
> log4j.appender.out.append=true
> log4j.appender.out.maxFileSize=1MB
> log4j.appender.out.maxBackupIndex=10
> 
> 
> log4j.appender.custom = org.apache.log4j.RollingFileAppender
> log4j.appender.custom.append = true
> log4j.appender.custom.file = ${karaf.data}/log/userLog.log
> log4j.appender.custom.layout = org.apache.log4j.PatternLayout
> log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
> %-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
> %m%n
> log4j.appender.custom.maxBackupIndex = 10
> log4j.appender.custom.maxFileSize = 1MB
> 
> log4j.logger.com.globalhealth.referralnet.agent.exception = INFO,custom
> log4j.logger.com.globalhealth.referralnet.agent.logger = INFO,custom
> log4j.logger.com.globalhealth.referralnet.agent.upgrade.impl.RNAUpgradeUserLogger
> = INFO,custom
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: custom log file size not restricted

Posted by jyothi <jy...@promantia.com>.
Hi JB,

Thanks for the quick response!!

Regarding spaces, that is generated one using config:property-append from
Karaf console. I will try to remove spaces and check if it works!!

Please find my complete pax logging config and I didn't added anything to
rootLogger. Do I need to add custom to the log4j.rootLogger?

# Root logger
log4j.rootLogger = INFO, out, osgi:*
log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer

# Security audit logger
log4j.logger.org.apache.karaf.jaas.modules.audit=INFO, audit
log4j.additivity.org.apache.karaf.jaas.modules.audit=false

# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p |
%-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
%X{bundle.version} | %m%n

# File appender
log4j.appender.out=org.apache.log4j.RollingFileAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern = %d{ISO8601} | %-5.5p | %t |
%c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
log4j.appender.out.file=${karaf.data}/log/karaf.log
log4j.appender.out.append=true
log4j.appender.out.maxFileSize=1MB
log4j.appender.out.maxBackupIndex=10


log4j.appender.custom = org.apache.log4j.RollingFileAppender
log4j.appender.custom.append = true
log4j.appender.custom.file = ${karaf.data}/log/userLog.log
log4j.appender.custom.layout = org.apache.log4j.PatternLayout
log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
%-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
%m%n
log4j.appender.custom.maxBackupIndex = 10
log4j.appender.custom.maxFileSize = 1MB

log4j.logger.com.globalhealth.referralnet.agent.exception = INFO,custom
log4j.logger.com.globalhealth.referralnet.agent.logger = INFO,custom
log4j.logger.com.globalhealth.referralnet.agent.upgrade.impl.RNAUpgradeUserLogger
= INFO,custom






--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: custom log file size not restricted

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

It should work (it's what we are using without problem for "out" appender).

I guess you added this appender in the logger (rootLogger or specific logger) 
right ?

Can you try to remove extra spaces around '=' ?

Regards
JB

On 12/13/2017 07:05 AM, jyothi wrote:
> Hi,
> 
> I have configured for a custom log in pax logging in Karaf as follows and
> found the size of the custom log is not restricted to 1 MB and increasing.
> Can you please let us know what could be the issue? Thanks in advance
> 
> log4j.appender.custom = org.apache.log4j.RollingFileAppender
> log4j.appender.custom.append = true
> log4j.appender.custom.file = ${karaf.data}/log/custom.log
> log4j.appender.custom.layout = org.apache.log4j.PatternLayout
> log4j.appender.custom.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss Z} |
> %-5.5p | %t | %c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} |
> %m%n
> log4j.appender.custom.maxBackupIndex = 10
> log4j.appender.custom.maxFileSize = 1MB
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com