Environment Variables for zmc and zma debug level
Posted: Sun Jan 02, 2005 6:46 am
I've been using the ZoneMinder software now for a couple days and I'm very impressed at the capabilities. I've run into a few issues and I've noted some things about the software and I'll post my findings in a few different topics.
The first issue is that it appears the documentation is wrong for setting the debug level for at least the zmc and zma programs. I needed to run zmc from the command line with full debug output so I could get some information on a issue I was having with a remote camera (that problem is in another topic). I exported the environment variable "ZM_DBG_LEVEL_zmc=9" but saw no difference in the debug output.
I took a look in the code and found that when initializing debug, the code looks in the environment for a variable named "ZM_DBG_LEVEL_" + the content of a variable called "zm_dbg_name". In the case of zmc (and zms), zm_dbg_name does not get set to "zmc", but rather "zmc" + "-" + the monitor id, which means, for example "zmc-d0" or "zmc-m1". This means that the environment variable would need to be named accordingly except it appears that "-" is an illegal character for an environment variable on linux.
As a test, I changed the code in zmc.cpp and zma.cpp to use an underscore instead of a hyphen ("zmc_m1") for the zm_dbg_name. I recompiled and set the environment variable as "ZM_DBG_LEVEL_zmc_m1=9". Then I got the full debugging output I expected. This also allows you to have a separate debug level for each copy of zmc for each monitor that you have which is very nice. If one particular monitor is giving you trouble, you can bump the debug level just for that one.
The first issue is that it appears the documentation is wrong for setting the debug level for at least the zmc and zma programs. I needed to run zmc from the command line with full debug output so I could get some information on a issue I was having with a remote camera (that problem is in another topic). I exported the environment variable "ZM_DBG_LEVEL_zmc=9" but saw no difference in the debug output.
I took a look in the code and found that when initializing debug, the code looks in the environment for a variable named "ZM_DBG_LEVEL_" + the content of a variable called "zm_dbg_name". In the case of zmc (and zms), zm_dbg_name does not get set to "zmc", but rather "zmc" + "-" + the monitor id, which means, for example "zmc-d0" or "zmc-m1". This means that the environment variable would need to be named accordingly except it appears that "-" is an illegal character for an environment variable on linux.
As a test, I changed the code in zmc.cpp and zma.cpp to use an underscore instead of a hyphen ("zmc_m1") for the zm_dbg_name. I recompiled and set the environment variable as "ZM_DBG_LEVEL_zmc_m1=9". Then I got the full debugging output I expected. This also allows you to have a separate debug level for each copy of zmc for each monitor that you have which is very nice. If one particular monitor is giving you trouble, you can bump the debug level just for that one.