Archived

This forum has been archived. Please start a new discussion on GitHub.

Is there a way to prohibit outputs of console?

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!

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    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.

    Dwayne
  • Thanks. But is there any simple way, for example, by configuring ice?
  • dwayne
    dwayne St. John's, Newfoundland
    No, there is no way to disable all messages through simple configuration.

    Dwayne
  • xdm
    xdm La Coruña, Spain
    Hi Dong

    Note that you can use Ice.StdOut and Ice.StdErr properties to redirect console output to a normal file.

    This properties are documented in Ice book appendice C.

    Regards
  • Thanks Jose!I think it's a good solution.:D
  • 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?
  • xdm
    xdm La Coruña, Spain
    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 help
  • 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!
  • xdm
    xdm La Coruña, Spain
    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.

    Jose
  • OK, I'll read and try it. Thank you for your patient replying!