summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cs/CHANGES5
-rwxr-xr-xcs/src/Ice/Instance.cs37
-rwxr-xr-xcs/src/Ice/PropertiesI.cs2
3 files changed, 44 insertions, 0 deletions
diff --git a/cs/CHANGES b/cs/CHANGES
index 703e75807ae..2e4aa2c23ce 100644
--- a/cs/CHANGES
+++ b/cs/CHANGES
@@ -1,3 +1,8 @@
+Changes since version 1.5.1
+---------------------------
+- New properties Ice.StdErr and Ice.StdOut to redirect the standard
+ error and output streams of a process.
+
Changes since version 1.5.0
---------------------------
diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs
index 0be8cd75968..29401fdc4c8 100755
--- a/cs/src/Ice/Instance.cs
+++ b/cs/src/Ice/Instance.cs
@@ -300,6 +300,39 @@ namespace IceInternal
try
{
+ lock(_staticLock)
+ {
+ if(!_oneOffDone)
+ {
+ string stdOut = _properties.getProperty("Ice.StdOut");
+ string stdErr = _properties.getProperty("Ice.StdErr");
+
+ System.IO.StreamWriter outStream = null;
+
+ if(stdOut.Length > 0)
+ {
+ outStream = System.IO.File.AppendText(stdOut);
+ outStream.AutoFlush = true;
+ System.Console.SetOut(outStream);
+ }
+ if(stdErr.Length > 0)
+ {
+ if(stdErr.Equals(stdOut))
+ {
+ System.Console.SetError(outStream);
+ }
+ else
+ {
+ System.IO.StreamWriter errStream = System.IO.File.AppendText(stdErr);
+ errStream.AutoFlush = true;
+ System.Console.SetError(errStream);
+ }
+ }
+
+ _oneOffDone = true;
+ }
+ }
+
if(_properties.getPropertyAsInt("Ice.UseSyslog") > 0)
{
_logger = new Ice.SysLoggerI(_properties.getProperty("Ice.ProgramName"));
@@ -584,6 +617,10 @@ namespace IceInternal
private Ice.PluginManager _pluginManager;
private volatile BufferManager _bufferManager; // Immutable, not reset by destroy().
private volatile static bool _printProcessIdDone = false;
+
+ private static bool _oneOffDone = false;
+ private static System.Object _staticLock = new System.Object();
+
}
}
diff --git a/cs/src/Ice/PropertiesI.cs b/cs/src/Ice/PropertiesI.cs
index 77256b7eefc..c9bfacac58f 100755
--- a/cs/src/Ice/PropertiesI.cs
+++ b/cs/src/Ice/PropertiesI.cs
@@ -395,6 +395,8 @@ namespace Ice
"PrintProcessId",
"ProgramName",
"RetryIntervals",
+ "StdErr",
+ "StdOut",
"ServerId",
"ServerIdleTime",
"ThreadPool.Client.Size",