[
https://issues.apache.org/jira/browse/LOG4J2-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14548589#comment-14548589
]
Gary Gregory edited comment on LOG4J2-1013 at 5/18/15 7:23 PM:
---------------------------------------------------------------
Crud, I see two problems here and I am surprised you got this far.
# Because the main map lookup is not a Log4j plugin but instead a special slot
in the map lookup plugin, it is not registered in Log4j as a plugin
(obvisouly). This means Log4j does not see it when it starts up and configures
a logger context. I have a fix for that which makes the main map look up a
plugin.
# The next problem is that Log4j uses the characters _colon_ and _minus_ are
variable value delimiters when it is parsing the pattern. This is defined here
{{org.apache.logging.log4j.core.lookup.StrSubstitutor.DEFAULT_VALUE_DELIMITER}}.
I wonder if it is possible to escape the _minus_ in {{--file}}...
was (Author: garydgregory):
Crud, I see two problems here and I am surprised you got this far.
# Because the main map lookup is not a Log4j plugin but instead a special slot
in the map lookup plugin, it is not registered in Log4j as a plugin
(obvisouly). This means Log4j does not see it when it starts up and configures
a logger context. I have a fix for that which makes the main map look up a
plugin.
# The next problem is that Log4j uses the characters {{:}} and {{-}} are
variable value delimiters when it is parsing the pattern. I'm not sure why but
I or someone will have to look at that (later for me).
> Log4j2 Main Arguments Lookup by name doesn't work
> -------------------------------------------------
>
> Key: LOG4J2-1013
> URL: https://issues.apache.org/jira/browse/LOG4J2-1013
> Project: Log4j 2
> Issue Type: Bug
> Components: API, Core, Lookups
> Affects Versions: 2.2
> Environment: Windows 7 x64 Ultimate and Java 8U31 x64. Project
> created using Eclipse.
> Reporter: Ioan Mihaila
> Priority: Critical
>
> Accessing Main Arguments by using index based look up works : ${main:0}
> Accessing Main Arguments by using name based look up doesn't work :
> ${main:--file}
> When trying to access by name it doesn't retrieve the argument but retrieves
> "-file".
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]