Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
89890dca
Commit
89890dca
authored
17 years ago
by
brinn
Browse files
Options
Downloads
Patches
Plain Diff
change: make the determination of the log level more flexible by using the LogAnnotation.logLevel()
SVN: 4331
parent
5be2fd27
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/source/java/ch/systemsx/cisd/common/logging/LogInvocationHandler.java
+20
-4
20 additions, 4 deletions
...ch/systemsx/cisd/common/logging/LogInvocationHandler.java
with
20 additions
and
4 deletions
common/source/java/ch/systemsx/cisd/common/logging/LogInvocationHandler.java
+
20
−
4
View file @
89890dca
...
@@ -33,7 +33,7 @@ public final class LogInvocationHandler implements InvocationHandler
...
@@ -33,7 +33,7 @@ public final class LogInvocationHandler implements InvocationHandler
{
{
private
final
Object
object
;
private
final
Object
object
;
private
final
String
name
;
private
final
String
name
;
private
final
Level
l
ogLevel
;
private
final
Level
defaultL
ogLevel
;
private
final
Class
<?>
classUsedToNameLogger
;
private
final
Class
<?>
classUsedToNameLogger
;
/**
/**
...
@@ -48,7 +48,7 @@ public final class LogInvocationHandler implements InvocationHandler
...
@@ -48,7 +48,7 @@ public final class LogInvocationHandler implements InvocationHandler
{
{
this
.
object
=
object
;
this
.
object
=
object
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
l
ogLevel
=
logLevel
;
this
.
defaultL
ogLevel
=
logLevel
;
this
.
classUsedToNameLogger
=
classUsedToNameLogger
;
this
.
classUsedToNameLogger
=
classUsedToNameLogger
;
}
}
...
@@ -73,6 +73,7 @@ public final class LogInvocationHandler implements InvocationHandler
...
@@ -73,6 +73,7 @@ public final class LogInvocationHandler implements InvocationHandler
throw
t
;
throw
t
;
}
finally
}
finally
{
{
final
Level
logLevel
=
getLogLevel
(
method
);
final
Logger
logger
=
createLogger
(
method
);
final
Logger
logger
=
createLogger
(
method
);
if
(
throwable
!=
null
||
logger
.
isEnabledFor
(
logLevel
))
if
(
throwable
!=
null
||
logger
.
isEnabledFor
(
logLevel
))
{
{
...
@@ -101,8 +102,23 @@ public final class LogInvocationHandler implements InvocationHandler
...
@@ -101,8 +102,23 @@ public final class LogInvocationHandler implements InvocationHandler
}
}
}
}
}
}
private
Logger
createLogger
(
Method
method
)
private
Level
getLogLevel
(
Method
method
)
{
final
LogAnnotation
annotation
=
method
.
getAnnotation
(
LogAnnotation
.
class
);
if
(
annotation
==
null
)
{
return
Level
.
DEBUG
;
}
else
if
(
annotation
.
logLevel
().
equals
(
LogLevel
.
UNDEFINED
))
{
return
defaultLogLevel
;
}
else
{
return
Log4jSimpleLogger
.
toLog4jPriority
(
annotation
.
logLevel
());
}
}
private
Logger
createLogger
(
Method
method
)
{
{
final
LogAnnotation
annotation
=
method
.
getAnnotation
(
LogAnnotation
.
class
);
final
LogAnnotation
annotation
=
method
.
getAnnotation
(
LogAnnotation
.
class
);
final
LogCategory
logCategory
=
(
annotation
==
null
)
?
LogCategory
.
ACCESS
:
annotation
.
logCategory
();
final
LogCategory
logCategory
=
(
annotation
==
null
)
?
LogCategory
.
ACCESS
:
annotation
.
logCategory
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment