Archived
This forum has been archived. Please start a new discussion on GitHub.
Is there a way to prohibit outputs of console?
bxhsix
in Help Center
Hi
I am developing a project with ice. My use with ice has no console. But ice will output something automatically now and then, such as some warnings. However, I don't need them at all. Is there any configurations that can prohibit all outputs? If I wanna achieve this, what should I do?
Thanks for all help!
I am developing a project with ice. My use with ice has no console. But ice will output something automatically now and then, such as some warnings. However, I don't need them at all. Is there any configurations that can prohibit all outputs? If I wanna achieve this, what should I do?
Thanks for all help!
0
Comments
-
You can create a custom logger for Ice to use instead of it's default logger. For example, you could have your custom logger write to a file rather than the console if you so desire. Please see section 32.18 of the manual for more details.
Dwayne0 -
But another question occurs. I must clear the log file periodically. What I want is no outputs, because my program has no console at all. I think ice should have considered the problem that some program(especially in windows)has no console. If such program has outputs, it will collapse. Are there any other solutions to prohibit all warnings or how many warning are there in total?0
-
Hi Dong,
You can control Ice warning messages with the relevant Ice.Trace properties, maybe you can post the messages you are talking about to made that a bit more clear.
By the way you can log messages to windows log system using a convenient logger that is provided with Ice, you can read how to do that in Ice Manual.
If you use files you must rotate log files, this is typically done in linux by programas like logrotate. Not sure if there are such a thing for windows, but is not Ice specific at all.
I think the best behavior in windows is log to the windows event log, this is as well explained in the Ice book.
BTW your program must not have any side behabior in window by Ice messages redirect to the console, really it redirect messages to StdOut and StdErr, the only problem is that you are no able to view tha messages.
Also if you want more helpfull advise you must give as a bit more data about the exact problem you are viewing , operating system , compiler, Ice versions, etc.
Hope this help0 -
Thanks Jose very much!
What I am developing is a windows service application, which has no console at all. So I was afraid the warning outputs to console would make the system down. But now I am testing the program and hope it won't collapse as a result of outputs to an inexistent console. Can you help me to make sure of that?
Thanks again!0 -
Hi Dom,
If you are on windows why do not use the loger that comes with Ice to log to the windows log system?
I think is the best way to go for a windows service. At least is what a experience windows user waits of any service it install.
If for any reaseon the window log system is no god enought for you, that is not a problem at all, in sucha case, you must provide your logger implementation that can log messages in the way you think is more appropiate for you concrete use case.
For example you can log to a Sql database, to an other remote machine, or virtualy to other thing you want.
Implementing your custom log is an easy task an get you the freedom to choose where the logs messages ends.
BTW i encourage you to read the relevant manual sections that explain all this deeper and better.
Jose0
