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
a42d45e8
Commit
a42d45e8
authored
17 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
improve error message
SVN: 2339
parent
17156e99
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/sourceTest/java/ch/systemsx/cisd/common/logging/LogMonitoringAppender.java
+12
-3
12 additions, 3 deletions
...h/systemsx/cisd/common/logging/LogMonitoringAppender.java
with
12 additions
and
3 deletions
common/sourceTest/java/ch/systemsx/cisd/common/logging/LogMonitoringAppender.java
+
12
−
3
View file @
a42d45e8
...
...
@@ -36,6 +36,7 @@ public final class LogMonitoringAppender extends AppenderSkeleton
private
static
Map
<
LogMonitoringAppender
,
String
>
appenderMap
=
new
HashMap
<
LogMonitoringAppender
,
String
>();
private
final
StringBuilder
eventRecorder
=
new
StringBuilder
();
private
final
String
messagePart
;
private
LogMonitoringAppender
(
String
messagePart
)
...
...
@@ -91,7 +92,14 @@ public final class LogMonitoringAppender extends AppenderSkeleton
@Override
protected
void
append
(
LoggingEvent
event
)
{
if
(
event
.
getMessage
().
toString
().
contains
(
messagePart
)
||
getThrowableStr
(
event
).
contains
(
messagePart
))
String
eventMessage
=
event
.
getMessage
().
toString
();
eventRecorder
.
append
(
"event message: "
).
append
(
eventMessage
).
append
(
'\n'
);
String
throwableStr
=
getThrowableStr
(
event
);
if
(
throwableStr
.
length
()
>
0
)
{
eventRecorder
.
append
(
"event throwable: "
).
append
(
throwableStr
).
append
(
'\n'
);
}
if
(
eventMessage
.
contains
(
messagePart
)
||
throwableStr
.
contains
(
messagePart
))
{
logHappened
=
true
;
}
...
...
@@ -111,12 +119,13 @@ public final class LogMonitoringAppender extends AppenderSkeleton
public
void
verifyLogHasNotHappened
()
{
assert
logHappened
==
false
:
"Following log snipped was found but shouldn't have: "
+
messagePart
;
assert
logHappened
==
false
:
"Log snippet '"
+
messagePart
+
"' has been unexpectedly found in log:\n"
+
eventRecorder
;
}
public
void
verifyLogHasHappened
()
{
assert
logHappened
:
"
Following log snippet has been missed: "
+
messagePart
;
assert
logHappened
:
"
Log snippet '"
+
messagePart
+
"' has been missed in log:\n"
+
eventRecorder
;
}
public
void
reset
()
...
...
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