setting up logging in executables that link to samba libraries

View: New views
3 Messages — Rating Filter:   Alert me  

setting up logging in executables that link to samba libraries

by Steve French-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am having trouble setting up the cifs.upcall program to log to samba
logs (/usr/local/samba33/var/log.*)
Apparently the following is not enough to get debug(0, ... messages to log.

     setup_logging(argv[0], false);
     load_case_tables();
     reopen_logs();

I did a quick test by checking lp_loaded's value after these lines and
it shows as false.  What sets lp_loaded to true?  Am I missing an init
step.   This runs in the background (launched by keyctl daemon) so
would be nice to be able to log the samba client lib calls it invokes
(wasn't able to get the samba client lib calls to log to syslog either
with the ./configure --with-syslog and smb.conf having "syslog = 10").

Any idea if there is a missing setup call that an executable needs to
do before enabling logging?

--
Thanks,

Steve

Re: setting up logging in executables that link to samba libraries

by Andreas Schneider-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve French wrote:
> Am having trouble setting up the cifs.upcall program to log to samba
> logs (/usr/local/samba33/var/log.*)
> Apparently the following is not enough to get debug(0, ... messages to log.
>
>      setup_logging(argv[0], false);
>      load_case_tables();
>      reopen_logs();
>


Hi Steve,


I think you have to do the following:


INIT
-----

/* track talloc null_context memory */
talloc_enable_null_tracking();

load_case_tables();
setup_logging(argv[0], false);

/* get_dyn_CONFIGFILE points to the std location. If that fails,
  * it silently ignores it and use the internal defaults.
  */
lp_load(get_dyn_CONFIGFILE(), True, False, False, False);

reopen_logs();

FREE
-----

gfree_names();
gfree_loadparm();
gfree_case_tables();
gfree_charcnv();

/* release the talloc null_context memory last */
talloc_disable_null_tracking();

gfree_debugsyms();



        -- andreas

Re: setting up logging in executables that link to samba libraries

by Steve French-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That didn't seem to work.  I can get it to work by explicitly setting
the log level and log file though.

      DEBUGLEVEL_CLASS[DBGC_ALL] = 10;
      debug_set_logfile("/var/log/cifs.upcall.log");


On Fri, Jul 25, 2008 at 6:03 AM, Andreas Schneider <anschneider@...> wrote:

> Steve French wrote:
>>
>> Am having trouble setting up the cifs.upcall program to log to samba
>> logs (/usr/local/samba33/var/log.*)
>> Apparently the following is not enough to get debug(0, ... messages to
>> log.
>>
>>     setup_logging(argv[0], false);
>>     load_case_tables();
>>     reopen_logs();
>>
>
>
> Hi Steve,
>
>
> I think you have to do the following:
>
>
> INIT
> -----
>
> /* track talloc null_context memory */
> talloc_enable_null_tracking();
>
> load_case_tables();
> setup_logging(argv[0], false);
>
> /* get_dyn_CONFIGFILE points to the std location. If that fails,
>  * it silently ignores it and use the internal defaults.
>  */
> lp_load(get_dyn_CONFIGFILE(), True, False, False, False);
>
> reopen_logs();
>
> FREE
> -----
>
> gfree_names();
> gfree_loadparm();
> gfree_case_tables();
> gfree_charcnv();
>
> /* release the talloc null_context memory last */
> talloc_disable_null_tracking();
>
> gfree_debugsyms();
>
>
>
>        -- andreas
>



--
Thanks,

Steve