Hi all.
I ran in to a irritating problem today. It's a simple matter of wanting to change the CEGUI log file path to my apps directory (I'm on linux and CEGUI defaults to putting it in ~/ while I have a cross platform script to resolve the resource path for my app that yields ~/.app_name on linux). I figured this should be a piece of cake (famous last words tm) and quickly found the CEGUI::Logger::getSingleton().setLogFilename() function for this purpose.
Problem is that it fails with a assert failed when I call it. I have tried to call it high and low in the initialization chain (saw a post or two that pointed out it has to be called before CEGUI::System is created) but to no avail. I noticed, however, that all the forum posts where for older versions of CEGUI (some as old as 0.2.0 ;o) and I know a lot has changed since then (initialization of System for example) and figured it might be something like that.
I have also tried to use the CEGUI::System::create() method passing it the log file as an argument. This seem to work for the log but all of a sudden my resource manager got amnesia and forgot all of my loaded resources (I use Ogres resource loader to load them and CEGUI::DefaultResourceProvider() to get that to CEGUI, worked like a charm before this) despite the fact that I send it a handle to my resource provider.
I don't mind using the System::create() route for this (I'm all for knowing and being able to affect how the system initializes) but the documentation for more advanced initialization is spotty and old for the most part (or hidden? I haven't found it ;/) ...
Any help and/or pointers appreciated on this. I'll post code if you need it but I'm thinking I must have missed something completely so I'm skipping that for now ;o)
Cheers!
[Solved] Singelton assert failes when calling setLogFilename
Moderators: CEGUI MVP, CEGUI Team
[Solved] Singelton assert failes when calling setLogFilename
Last edited by d-Pixie on Sun Nov 14, 2010 15:37, edited 1 time in total.
Re: singelton assert failes when calling Logger setLogFilename
IMO the best way is to instantiate CEGUI::Logger yourself and set it's filename and then bootstrap the system. It will use your created logger. I do this to route all the logged CEGUI messages to my log system.
If you try to call CEGUI::Logger::getSingleton() before it's instantiate you will definitely get the mentioned assert fail.
Code:
If you try to call CEGUI::Logger::getSingleton() before it's instantiate you will definitely get the mentioned assert fail.
Code:
Code: Select all
new CEGUI::Logger();
CEGUI::Logger::getSingleton()....
bootstrap
Re: singelton assert failes when calling Logger setLogFilename
Oh
Might have been expected to figure that out on my own I guess ;o) It works nicely (however, to anyone comming along later, the CEGUI::Logger is partially virtual and you want to use the CEGUI::DefaultLogger instead). Thanks for that Kulik ;o)
BTW, is there any way to pass CEGUI the Ogre logger? Just figure that, down the line, you don't want to have three log files lying around (Ogre, CEGUI and your own) and want to roll them in to one. Writing your own log manager is an option but since both CEGUI and Ogre has them I figure I might as well use one of them for now.
Might have been expected to figure that out on my own I guess ;o) It works nicely (however, to anyone comming along later, the CEGUI::Logger is partially virtual and you want to use the CEGUI::DefaultLogger instead). Thanks for that Kulik ;o)
BTW, is there any way to pass CEGUI the Ogre logger? Just figure that, down the line, you don't want to have three log files lying around (Ogre, CEGUI and your own) and want to roll them in to one. Writing your own log manager is an option but since both CEGUI and Ogre has them I figure I might as well use one of them for now.
Re: singelton assert failes when calling Logger setLogFilename
It should be DefaultLogger, sorry about that.
Yeah, by inheriting from CEGUI::Logger and implementing the methods to call Ogre's log system's or your own log system's method.
d-Pixie wrote:BTW, is there any way to pass CEGUI the Ogre logger? Just figure that, down the line, you don't want to have three log files lying around (Ogre, CEGUI and your own) and want to roll them in to one. Writing your own log manager is an option but since both CEGUI and Ogre has them I figure I might as well use one of them for now.
Yeah, by inheriting from CEGUI::Logger and implementing the methods to call Ogre's log system's or your own log system's method.
Re: singelton assert failes when calling Logger setLogFilename
Thanks again Kulik.
I have been thinking about the log manager since I last posted and have convinced myself that writing my own might be handy after all. So I'll probable replace both CEGUIs and Ogres defaults with my own (tomorrow I think, or maybe the day after that ;o)
I have been thinking about the log manager since I last posted and have convinced myself that writing my own might be handy after all. So I'll probable replace both CEGUIs and Ogres defaults with my own (tomorrow I think, or maybe the day after that ;o)
Who is online
Users browsing this forum: No registered users and 10 guests