Pgm Output is Interleaved with other pgms

Hi
I have a shared object which is called from a third party tool.
In my .so, I am using 'freopen(mylogfilename,"at",stderr)'. It is logging all my program output and it is also writing warning messages from the third party daemons also.

   How can I avoid these unwanted messages logging into my log file. I want only my program messages. 

Any pointers please.
Thanks in advance

You can't, you're all sharing the same stderr. Maybye just use your own file pointer instead of reopening stderr?