I'm asking because there's an outstanding request to support the formatted timestamp in the JSON layout. (It currently has timestamp as an epoch long.)
This would be a nice way to address that and potential other future needs. I can't find the JIRA ticket for it now. Maybe it was on stackoverflow. This one is close but I want to go one step further. https://issues.apache.org/jira/browse/LOG4J2-1694 Sent from my iPhone > On Jan 8, 2017, at 8:36, Matt Sicker <boa...@gmail.com> wrote: > > It looks like GelfLayout uses a StrSubstitutor, but no PatternLayout. That'd > be an interesting implementation. > >> On 7 January 2017 at 17:32, Remko Popma <remko.po...@gmail.com> wrote: >> Nice! >> Can pattern layout patterns be used here? >> E.g. Include formatted event timestamp like this? >>> <KeyValuePair key="eventTime" value="%d{ABSOLUTE}"/> >> >> Sent from my iPhone >> >>> On Jan 8, 2017, at 6:37, mi...@apache.org wrote: >>> >>> Repository: logging-log4j2 >>> Updated Branches: >>> refs/heads/master eb51bef26 -> e185310a3 >>> >>> >>> LOG4J-1724 Improve documentation >>> >>> >>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo >>> Commit: >>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e185310a >>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e185310a >>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e185310a >>> >>> Branch: refs/heads/master >>> Commit: e185310a3cc70568713820368cf31eb94fe8f21d >>> Parents: eb51bef >>> Author: Mikael Ståldal <mikael.stal...@magine.com> >>> Authored: Sat Jan 7 22:37:21 2017 +0100 >>> Committer: Mikael Ståldal <mikael.stal...@magine.com> >>> Committed: Sat Jan 7 22:37:21 2017 +0100 >>> >>> ---------------------------------------------------------------------- >>> src/site/xdoc/manual/layouts.xml.vm | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> ---------------------------------------------------------------------- >>> >>> >>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e185310a/src/site/xdoc/manual/layouts.xml.vm >>> ---------------------------------------------------------------------- >>> diff --git a/src/site/xdoc/manual/layouts.xml.vm >>> b/src/site/xdoc/manual/layouts.xml.vm >>> index 8c5ea8a..a447e1a 100644 >>> --- a/src/site/xdoc/manual/layouts.xml.vm >>> +++ b/src/site/xdoc/manual/layouts.xml.vm >>> @@ -200,8 +200,8 @@ logger.debug("one={}, two={}, three={}", 1, 2, 3); >>> <Appenders> >>> <Socket name="Graylog" protocol="udp" host="graylog.domain.com" >>> port="12201"> >>> <GelfLayout host="someserver" compressionType="GZIP" >>> compressionThreshold="1024"> >>> - <KeyValuePair key="additionalField1" value="additional >>> value 1"/> >>> - <KeyValuePair key="additionalField2" value="additional >>> value 2"/> >>> + <KeyValuePair key="additionalField1" value="constant >>> value"/> >>> + <KeyValuePair key="additionalField2" >>> value="$${ctx:key}"/> >>> </GelfLayout> >>> </Socket> >>> </Appenders> >>> > > > > -- > Matt Sicker <boa...@gmail.com>