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
fa36d8e5
Commit
fa36d8e5
authored
17 years ago
by
brinn
Browse files
Options
Downloads
Patches
Plain Diff
change: show output of rsync executable if rsync exits with exit value != 0
SVN: 1809
parent
5112a8a1
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
datamover/source/java/ch/systemsx/cisd/datamover/filesystem/common/CmdLineHelper.java
+43
-32
43 additions, 32 deletions
...temsx/cisd/datamover/filesystem/common/CmdLineHelper.java
with
43 additions
and
32 deletions
datamover/source/java/ch/systemsx/cisd/datamover/filesystem/common/CmdLineHelper.java
+
43
−
32
View file @
fa36d8e5
...
@@ -21,8 +21,8 @@ import java.io.IOException;
...
@@ -21,8 +21,8 @@ import java.io.IOException;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.log4j.Level
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.Logger
;
import
ch.systemsx.cisd.common.utilities.OSUtilities
;
import
ch.systemsx.cisd.common.utilities.OSUtilities
;
/**
/**
...
@@ -98,41 +98,52 @@ public class CmdLineHelper
...
@@ -98,41 +98,52 @@ public class CmdLineHelper
private
void
logProcessExitValue
(
final
int
exitValue
,
final
Process
process
,
String
command
)
private
void
logProcessExitValue
(
final
int
exitValue
,
final
Process
process
,
String
command
)
{
{
if
(
operationLog
.
isDebugEnabled
()
)
if
(
exitValue
!=
0
)
{
{
if
(
processTerminated
(
exitValue
))
primLogProcessExitValue
(
Level
.
WARN
,
exitValue
,
command
);
{
logProcessOutput
(
process
,
command
);
operationLog
.
debug
(
String
.
format
(
"[%s] process was destroyed."
,
command
));
}
else
if
(
operationLog
.
isDebugEnabled
())
}
else
{
primLogProcessExitValue
(
Level
.
DEBUG
,
exitValue
,
command
);
}
}
private
void
primLogProcessExitValue
(
Level
logLevel
,
final
int
exitValue
,
String
command
)
{
if
(
processTerminated
(
exitValue
))
{
operationLog
.
log
(
logLevel
,
String
.
format
(
"[%s] process was destroyed."
,
command
));
}
else
{
operationLog
.
log
(
logLevel
,
String
.
format
(
"[%s] process returned with exit value %d."
,
command
,
exitValue
));
}
}
private
void
logProcessOutput
(
final
Process
process
,
String
command
)
{
final
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
process
.
getInputStream
()));
try
{
machineLog
.
warn
(
String
.
format
(
"[%s] output:"
,
command
));
String
ln
;
while
((
ln
=
reader
.
readLine
())
!=
null
)
{
{
operationLog
.
debug
(
String
.
format
(
"[%s] process returned with exit value %d."
,
command
,
exitValue
));
if
(
ln
.
trim
().
length
()
>
0
)
machineLog
.
warn
(
String
.
format
(
"\"%s\""
,
ln
));
}
}
if
(
exitValue
!=
0
)
}
catch
(
IOException
e
)
{
operationLog
.
warn
(
String
.
format
(
"IOException when trying to read stderr, msg='%s'."
,
e
.
getMessage
()));
}
finally
{
try
{
reader
.
close
();
}
catch
(
IOException
e
)
{
{
final
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
process
.
getInputStream
()));
// Silence this.
try
{
machineLog
.
debug
(
String
.
format
(
"[%s] output:"
,
command
));
String
ln
;
while
((
ln
=
reader
.
readLine
())
!=
null
)
{
if
(
ln
.
trim
().
length
()
>
0
)
machineLog
.
debug
(
String
.
format
(
"\"%s\""
,
ln
));
}
}
catch
(
IOException
e
)
{
operationLog
.
debug
(
String
.
format
(
"IOException when trying to read stderr, msg='%s'."
,
e
.
getMessage
()));
}
finally
{
try
{
reader
.
close
();
}
catch
(
IOException
e
)
{
// Silence this.
}
}
}
}
}
}
}
}
...
...
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