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
396017d7
Commit
396017d7
authored
5 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-8850: Create a marker file after successful server start up
parent
3a6883b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis-common/source/java/ch/systemsx/cisd/openbis/common/spring/MarkerLogApplicationListener.java
+18
-3
18 additions, 3 deletions
...d/openbis/common/spring/MarkerLogApplicationListener.java
with
18 additions
and
3 deletions
openbis-common/source/java/ch/systemsx/cisd/openbis/common/spring/MarkerLogApplicationListener.java
+
18
−
3
View file @
396017d7
...
...
@@ -16,6 +16,9 @@
package
ch.systemsx.cisd.openbis.common.spring
;
import
java.io.File
;
import
java.io.IOException
;
import
org.apache.log4j.Logger
;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.context.ApplicationListener
;
...
...
@@ -28,13 +31,15 @@ import ch.systemsx.cisd.common.logging.LogCategory;
import
ch.systemsx.cisd.common.logging.LogFactory
;
/**
* An application listener, whose sole purpose is to log a marker message
immediately after the successful start/stop of the openBIS application
* server.
* An application listener, whose sole purpose is to log a marker message
and create a marker file
*
immediately after the successful start/stop of the openBIS application
server.
*
* @author Kaloyan Enimanev
*/
public
class
MarkerLogApplicationListener
implements
ApplicationListener
{
private
static
final
File
STARTED_FILE
=
new
File
(
"SERVER_STARTED"
);
private
static
final
Logger
operationLog
=
LogFactory
.
getLogger
(
LogCategory
.
OPERATION
,
MarkerLogApplicationListener
.
class
);
...
...
@@ -52,10 +57,20 @@ public class MarkerLogApplicationListener implements ApplicationListener
// root application context has been initialized
}
else
{
// print a marker string to make it possible
// print a marker string
and create marker file
to make it possible
// for log-analyzing software to determine when the application is up and
// running
operationLog
.
info
(
"SERVER STARTED"
);
try
{
STARTED_FILE
.
createNewFile
();
STARTED_FILE
.
deleteOnExit
();
operationLog
.
info
(
STARTED_FILE
.
getAbsolutePath
()+
" created"
);
}
catch
(
IOException
ex
)
{
operationLog
.
error
(
"Couldn't create marker file "
+
STARTED_FILE
,
ex
);
}
}
}
else
if
(
isStoppingEvent
(
event
))
{
...
...
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