[
https://issues.apache.org/jira/browse/LOG4J2-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15145841#comment-15145841
]
Gary Gregory edited comment on LOG4J2-33 at 2/14/16 1:39 AM:
-------------------------------------------------------------
What I would expect of annotations is this:
{code:java}
@LogFlow("public")
public class SomeApis {
private int foo() { ... }
public int bar(int a, int b) {
...
return c;
}
public int zoo(Path p1, String s1) {
...
return c;
}
}
{code}
to be the same as :
{code:java}
public class SomeApis {
private int foo() { ... }
@LogFlow
public int bar(int a, int b) {
...
return c;
}
@LogFlow
public int zoo(Path p1, String s1) {
...
return c;
}
}
{code}
And I would expect:
{code:java}
@LogFlow
public int zoo(Path p1, String s1) {
...
if (...) {
return x;
}
...
return c;
}
{code}
To weave in:
{code:java}
public int zoo(Path p1, String s1) {
EntryMessage m = logger.traceEntry("zoo(p1={}, p2={})", p1, s1);
...
if (...) {
return traceExit(x, m);
}
...
return traceExit(c, m);
}
{code}
I could also see being able to say:
{code:java}
@LogFlow(types=false)
public int zoo(Path p1, String s1) {
...
}
{code}
To get:
{code:java}
EntryMessage m = logger.traceEntry("zoo({}, {})", p1, s1);
{code}
For folks who like logging message more succinct.
was (Author: garydgregory):
What I would expect of annotations is this:
{code:java}
@LogFlow("public")
public class SomeApis {
private int foo() { ... }
public int bar(int a, int b) {
...
return c;
}
public int zoo(Path p1, String s1) {
...
return c;
}
}
{code}
to be the same as :
{code:java}
public class SomeApis {
private int foo() { ... }
@LogFlow
public int bar(int a, int b) {
...
return c;
}
@LogFlow
public int zoo(Path p1, String s1) {
...
return c;
}
}
{code}
And I would expect:
{code:java}
@LogFlow
public int zoo(Path p1, String s1) {
...
if (...) {
return x;
}
...
return c;
}
{code}
To weave in:
{code:java}
public int zoo(Path p1, String s1) {
EntryMessage m = logger.traceEntry("zoo(p1={}, p2={})");
...
if (...) {
return traceExit(x, m);
}
...
return traceExit(c, m);
}
{code}
I could also see being able to say:
{code:java}
@LogFlow(types=false)
public int zoo(Path p1, String s1) {
...
}
{code}
To get:
{code:java}
EntryMessage m = logger.traceEntry("zoo({}, {})");
{code}
For folks who like logging message more succinct.
> Support Annotations
> -------------------
>
> Key: LOG4J2-33
> URL: https://issues.apache.org/jira/browse/LOG4J2-33
> Project: Log4j 2
> Issue Type: New Feature
> Components: API
> Affects Versions: 2.0-rc2
> Reporter: Ralph Goers
> Fix For: 0.1, 2.3
>
> Attachments: 0001-Add-Loggable.patch
>
>
> The Log4j API should support using annotations as provided in Java 6 so
> applications can use them instead of calls to logger APIs. This is especially
> useful for entering & exiting type of events, but could be used wherever
> annotations are allowed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]