The problem is that DirectNotify (and the lower-level C++ notify system) read the output filename at the very startup of the application, that is when you import panda3d.core, so by the time you have run loadPrcFileData() it is too late to change it.
One solution would be to put the notify-output command in an external prc file, which is always read at application start. This doesn’t help if you want to generate a dynamic filename as you are doing here, though.
So, another solution is to use the low-level calls to specifically redirect the notify systems to your log file, instead of going through the prc system, like this:
I know, that’s because the first part would be called before base = ShowBase.ShowBase(), and then afterwards um() would be called otherwise it gets mad at me saying base doesn’t exist.
I just didn’t include that in the code.
And David, let me show you what I mean when I can’t get the info to appear.
In my config.prc I have notify-level set to info.
Then in my code, I’ll have this.
from direct.directnotify import DirectNotifyGlobal
notify = DirectNotifyGlobal.directNotify.newCategory('NotifyTest')
notify.warning('Hi! I show in the log file.')
notify.info('Hi :( I don\'t show in the log file, not even in the console.')
Yes, it is reading my custom Config.prc, as there is the window title I set, along with the icon, graphics pipe, audio library, etc. But here’s the weird thing. I use the code that you provided, and this is what I got in the console.
(The … is just for privacy, normally there would be my name and the directory.)
So yeah, it’s reading that my notify-level is set to info. But then after that, the default one in the Panda3D directory shows up. I wonder if that’s modifying it. I’ll try changing it and see what happens.
I didn’t have default-directnotify-level in my config. Whoops.
I’m still having issues with logging, but that’s for later I suppose.