Dynamic Log Route Change From Controller


Right now, when I want to specify logging for certain category to go to a different table, I modify my config file

and add something like


                    'class' => 'CDbLogRoute',

                    'logTableName' => 'test',

                    'categories' => 'test.*',

                    'connectionID' => 'db'


What I’d like to do is to specify the same thing but from a Controller instead of a config file.

I was trying to fetch the CLogRouter and use getRoutes() and setRoutes() but without much success.

The reason for this is the fact that my config file has started to pile up log definitions which probably shouldn’t be there. (I.e. some of them will be used only shortly)

Any ideas?