[jboss-jira] [JBoss JIRA] (WFLY-2981) Add a date format attribute to the list-log-files operation

James Perkins (JIRA) issues at jboss.org
Mon Apr 21 18:04:33 EDT 2014


    [ https://issues.jboss.org/browse/WFLY-2981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12962898#comment-12962898 ] 

James Perkins commented on WFLY-2981:
-------------------------------------

After thinking on this a bit I'm wondering if it's worth the effort to add a separate attribute to the return type. While adding the attribute is simple enough, it would require a model version bump and probably a transformer. Using a {{SimpleDateFormat}} is fairly easy and I would assume other languages have something similar.

The following snippet seems reasonable enough to me, but let me know if it wouldn't work for you.
{code:java}
        final ModelControllerClient client = ModelControllerClient.Factory.create("localhost", 9990);
        final ModelNode address = new ModelNode().setEmptyList();
        address.add("subsystem", "logging");
        final ModelNode op = Operations.createOperation("list-log-files", address);
        final ModelNode result = client.execute(op);
        if (Operations.isSuccessfulOutcome(result)) {
            final ModelNode logFiles = Operations.readResult(result);
            final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
            for (ModelNode fileInfo : logFiles.asList()) {
                System.out.printf("File: %s - Last Modified: %s%n", fileInfo.get("file-name").asString(), sdf.parse(fileInfo.get("last-modified-date").asString()));
            }
        }
{code}
                
> Add a date format attribute to the list-log-files operation
> -----------------------------------------------------------
>
>                 Key: WFLY-2981
>                 URL: https://issues.jboss.org/browse/WFLY-2981
>             Project: WildFly
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: Logging
>            Reporter: James Perkins
>            Assignee: James Perkins
>            Priority: Minor
>
> The {{list-log-files}} operation outputs the last modified date of the available log files. The current date format is {{yyyy-MM-dd'T'HH:mm:ss.SSSZ}}, but it could be useful for the operation to allow any valid {{SimpleDateFormat}} to be used.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list