[jira] [Commented] (LOG4J2-1013) Log4j2 Main Arguments Lookup by name doesn't work
[ https://issues.apache.org/jira/browse/LOG4J2-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16626172#comment-16626172 ] ASF GitHub Bot commented on LOG4J2-1013: Github user fdiazgon commented on the issue: https://github.com/apache/logging-log4j2/pull/159 Done. Although I think I messed a little bit with the history. > 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 > Attachments: > LOG4J2_1013_select_underlying_StrLookup_before_stripping_off_potential_default_values.patch > > > 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 (v7.6.3#76005)
[jira] [Commented] (LOG4J2-1013) Log4j2 Main Arguments Lookup by name doesn't work
[ https://issues.apache.org/jira/browse/LOG4J2-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16625720#comment-16625720 ] ASF GitHub Bot commented on LOG4J2-1013: Github user remkop commented on the issue: https://github.com/apache/logging-log4j2/pull/159 Can you rebase on master? This will also trigger another build. > 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 > Attachments: > LOG4J2_1013_select_underlying_StrLookup_before_stripping_off_potential_default_values.patch > > > 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 (v7.6.3#76005)
[jira] [Commented] (LOG4J2-1013) Log4j2 Main Arguments Lookup by name doesn't work
[ https://issues.apache.org/jira/browse/LOG4J2-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16625273#comment-16625273 ] ASF GitHub Bot commented on LOG4J2-1013: Github user fdiazgon commented on the issue: https://github.com/apache/logging-log4j2/pull/159 Hey @garydgregory @remkop. Could anyone check the status of this PR? It seems that Travis failed with an error not related to this code. > 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 > Attachments: > LOG4J2_1013_select_underlying_StrLookup_before_stripping_off_potential_default_values.patch > > > 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 (v7.6.3#76005)
[jira] [Commented] (LOG4J2-1013) Log4j2 Main Arguments Lookup by name doesn't work
[ https://issues.apache.org/jira/browse/LOG4J2-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16396377#comment-16396377 ] Fernando Díaz commented on LOG4J2-1013: --- See [https://github.com/apache/logging-log4j2/pull/159|https://github.com/apache/logging-log4j2/pull/159] Using that branch, if I run {{org.apache.logging.log4j.core.lookup.MainInputArgumentsLookupTest}} with the command line {{--file foo.txt}} and the following pattern layout: {code} %d [%t] [${main:1}][${main:-1}][${main:--file}][${main:bad:-${main:--file}}] %-5level: %msg%n%throwable {code} The output is: {code} 2018-03-13 02:23:40,824 [main] [foo.txt][1][foo.txt][foo.txt] ERROR: this is an error message {code} Taking a look at other tests, in particular in {{StrSubstitutorTest}}, I think the output {{[1]}} is correct because {{main}} is the key in that particular case. I've included some unit tests. All test pass. > 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 > Attachments: > LOG4J2_1013_select_underlying_StrLookup_before_stripping_off_potential_default_values.patch > > > 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 (v7.6.3#76005)
[jira] [Commented] (LOG4J2-1013) Log4j2 Main Arguments Lookup by name doesn't work
[ https://issues.apache.org/jira/browse/LOG4J2-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16396374#comment-16396374 ] ASF GitHub Bot commented on LOG4J2-1013: GitHub user fdiazgon opened a pull request: https://github.com/apache/logging-log4j2/pull/159 [LOG4J2-1013][Lookups] Allow variables with dashes [JIRA Issue](https://issues.apache.org/jira/browse/LOG4J2-1013) Move the logic of getting the default value from the StrSubstitutor to the Interpolator You can merge this pull request into a Git repository by running: $ git pull https://github.com/fdiazgon/logging-log4j2 LOG4J2-1013 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/logging-log4j2/pull/159.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #159 commit e092b278aee02fe1cdf2431d35b395fcce963190 Author: fdiazgon Date: 2018-03-13T01:15:27Z [LOG4J2-1013][Lookups] Allow variables with dashes Move the logic of getting the default value from the StrSubstitutor to the Interpolator > 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 > Attachments: > LOG4J2_1013_select_underlying_StrLookup_before_stripping_off_potential_default_values.patch > > > 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 (v7.6.3#76005)
[jira] [Commented] (LOG4J2-1013) Log4j2 Main Arguments Lookup by name doesn't work
[ https://issues.apache.org/jira/browse/LOG4J2-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16395529#comment-16395529 ] Fernando Díaz commented on LOG4J2-1013: --- Hi. I would like to work on this. Just one thing. I've been looking at the code and I still don't understand why there is a DEFAULT_VALUE_DELIMITER. I can not find in the documentation anything about a default value for properties. For example, if I run {{org.apache.logging.log4j.core.lookup.MainInputArgumentsLookupTest}} with the command line {{--file foo.txt}} and the following pattern layout: {quote}%d [%t] [${main:1}][${main:-1}][${main:--file}][${main:v:-bar}] %-5level: %msg%n%throwable {quote} The output is: {quote}2018-03-12 18:04:00,962 [main] [foo.txt][1][-file][bar] ERROR: this is an error message {quote} [bar] is ok because I didn't provide a value in the command line. However I can not find a similar example in the documentation. > 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 > Attachments: > LOG4J2_1013_select_underlying_StrLookup_before_stripping_off_potential_default_values.patch > > > 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 (v7.6.3#76005)