Discussion:
[jira] [Created] (LOG4J2-727) Need a way to create RollingRandomAccessFileAppender with custom manager
yair ogen (JIRA)
2014-07-21 14:00:57 UTC
Permalink
yair ogen created LOG4J2-727:
--------------------------------

Summary: Need a way to create RollingRandomAccessFileAppender with custom manager
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen


I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.



--
This message was sent by Atlassian JIRA
(v6.2#6252)
Remko Popma
2014-07-21 14:35:31 UTC
Permalink
The pattern layout has a header attribute that you can set.
This will be included to the beginning of each file, included the rolled
over ones.
Does that do what you need?
Post by yair ogen (JIRA)
--------------------------------
Summary: Need a way to create RollingRandomAccessFileAppender
with custom manager
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled
file. I'd like to extend RollingRandomAccessFileManagerFactory and set it
on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
Remko Popma (JIRA)
2014-09-24 10:45:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14146189#comment-14146189 ]

Remko Popma commented on LOG4J2-727:
------------------------------------

There is a built-in header/footer function you can use. This should work with RollingRandomAccessFileAppender (since LOG4J2-581 was fixed).

The header/footer feature is documented in the Layouts manual page. For example, see [Pattern Layout|http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout].
Post by yair ogen (JIRA)
Need a way to create RollingRandomAccessFileAppender with custom manager
------------------------------------------------------------------------
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
yair ogen (JIRA)
2014-09-28 11:22:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151079#comment-14151079 ]

yair ogen commented on LOG4J2-727:
----------------------------------

Thanks. My header is dynamic - i.e. it has mutable state.
Any solution for that?
Post by yair ogen (JIRA)
Need a way to create RollingRandomAccessFileAppender with custom manager
------------------------------------------------------------------------
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
yair ogen (JIRA)
2014-09-28 11:35:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151079#comment-14151079 ]

yair ogen edited comment on LOG4J2-727 at 9/28/14 11:34 AM:
------------------------------------------------------------

Thanks. My header is dynamic - i.e. it has mutable state.
Any solution for that?

Also - from reading the code wouldn't this header appear only in the first created file? Rolling files won't have this header - will they?


was (Author: yairogen):
Thanks. My header is dynamic - i.e. it has mutable state.
Any solution for that?
Post by yair ogen (JIRA)
Need a way to create RollingRandomAccessFileAppender with custom manager
------------------------------------------------------------------------
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Remko Popma (JIRA)
2014-09-28 11:56:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151091#comment-14151091 ]

Remko Popma commented on LOG4J2-727:
------------------------------------

One idea is to use a system property:
{code}
<PatternLayout>
<header>${sys:myProperty}</header>
<pattern>%d %p %c{1.} [%t] %m%n</pattern>
</PatternLayout>
{code}

LOG4J2-581 fixed the issue that the header was only created for the first file; it now works on rollover too.
Post by yair ogen (JIRA)
Need a way to create RollingRandomAccessFileAppender with custom manager
------------------------------------------------------------------------
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
yair ogen (JIRA)
2014-09-28 12:53:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151102#comment-14151102 ]

yair ogen commented on LOG4J2-727:
----------------------------------

how would that help? will the system property be re-evaluated for each new rolling file?
Post by yair ogen (JIRA)
Need a way to create RollingRandomAccessFileAppender with custom manager
------------------------------------------------------------------------
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Remko Popma (JIRA)
2014-09-28 21:55:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151241#comment-14151241 ]

Remko Popma commented on LOG4J2-727:
------------------------------------

Yes it will.
Post by yair ogen (JIRA)
Need a way to create RollingRandomAccessFileAppender with custom manager
------------------------------------------------------------------------
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
yair ogen (JIRA)
2014-09-29 06:12:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yair ogen closed LOG4J2-727.
----------------------------
Resolution: Not a Problem
Post by yair ogen (JIRA)
Need a way to create RollingRandomAccessFileAppender with custom manager
------------------------------------------------------------------------
Key: LOG4J2-727
URL: https://issues.apache.org/jira/browse/LOG4J2-727
Project: Log4j 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.0
Reporter: yair ogen
I have a requirement to dump a header in the beginning of each new rolled file. I'd like to extend RollingRandomAccessFileManagerFactory and set it on the appender I use but I don't see any option to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Loading...