Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log creaper commands in JSON format in debug #154

Merged
merged 1 commit into from
Feb 13, 2017

Conversation

mchoma
Copy link
Collaborator

@mchoma mchoma commented Feb 13, 2017

Resolves #151

It producelog output as:
INFO: Executing operation /core-service=management/security-realm=creaperSecRealm:add
JSON format:
{
"operation" : "add",
"address" : [
{
"core-service" : "management"
},
{
"security-realm" : "creaperSecRealm"
}
]
}

@mchoma
Copy link
Collaborator Author

mchoma commented Feb 13, 2017

following #153

@Ladicek
Copy link
Contributor

Ladicek commented Feb 13, 2017

You could have just adjusted #153, but whatever works for you :-)

@Ladicek
Copy link
Contributor

Ladicek commented Feb 13, 2017

Now looking at the 1st comment -- is the JSON format really multiline?

@mchoma
Copy link
Collaborator Author

mchoma commented Feb 13, 2017

Not sure, if I understand you correctly. When toJSONString(compact=false) is called, then yes operation is printed "nicely" on multiple lines.

@Ladicek
Copy link
Contributor

Ladicek commented Feb 13, 2017

Ah, I definitely don't want that on DEBUG level. That would be too much of a change. And if I remember correctly, you wanted that JSON for pasting into a curl invocation, so you should rather want a compact output, no?

@mchoma
Copy link
Collaborator Author

mchoma commented Feb 13, 2017

Ok. I will add then own TRACE level log entry for JSON format. I prefer compact=false, as it is more human-readable and curl is OK with it.

@Ladicek
Copy link
Contributor

Ladicek commented Feb 13, 2017

Ah, OK, thanks.

@Ladicek Ladicek merged commit e6810d4 into wildfly-extras:master Feb 13, 2017
@Ladicek Ladicek self-assigned this Feb 13, 2017
@Ladicek Ladicek added this to the 1.6.0 milestone Feb 13, 2017
@Ladicek
Copy link
Contributor

Ladicek commented Feb 13, 2017

Oh crap, I shouldn't have merged just yet :-( What's the difference between

log.tracef("JSON format:\n%s", operation.toJSONString(false));

and

log.tracef("JSON format:%n%s", operation.getOperation().toJSONString(false));

?

Specifically, I'm thinking about \n vs. %n.

Which one is correct?

@Ladicek
Copy link
Contributor

Ladicek commented Feb 14, 2017

@mchoma bump

@mchoma
Copy link
Collaborator Author

mchoma commented Feb 15, 2017

%n is correct, because it is platform independent.

Should I send new PR with only that change?

@rhatlapa
Copy link

Yes please.

@Ladicek
Copy link
Contributor

Ladicek commented Feb 15, 2017

Absolutely, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants