You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2014/09/27 16:10:35 UTC

[jira] [Commented] (LOG4J2-771) Add lookup for application main arguments

    [ https://issues.apache.org/jira/browse/LOG4J2-771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14150597#comment-14150597 ] 

Remko Popma commented on LOG4J2-771:
------------------------------------

Nice! (Gentle reminder: you may also want an entry in the left-hand side navigation menu)

> Add lookup for application main arguments
> -----------------------------------------
>
>                 Key: LOG4J2-771
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-771
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Core
>         Environment: Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T09:51:42-04:00)
> Maven home: C:\Java\apache-maven-3.2.2
> Java version: 1.7.0_60, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_60\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>             Fix For: 2.1
>
>         Attachments: mainlookup.diff
>
>
> As a user I want to use the following expression in configuration files:
> If my static void main String[] arguments are:
> --file foo.txt --verbose -x bar
> I should be able to say:
> - ${main:0} -> --file
> - ${main:1} -> foo.txt
> - ${main:2} -> --verbose
> - ${main:3} -> -x
> - ${main:4} -> bar
> - ${main:--file} -> foo.txt
> - ${main:-x} -> bar
> - ${main:bar} -> null
> For this to work, I have to call:
> {code:java}
> import org.apache.logging.log4j.core.lookup.MapLookup;
> public static void main(String args[]) {
>   //...
>   MapLookup.setMainArguments(args);
>   //...
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org