On Mar 16, 2010, at 18:46 , Andreas Jellinghaus wrote: > Am Dienstag 16 März 2010 17:36:31 schrieb Viktor TARASOV: >> is it wanted that now, when using 'pkcs15-init' tool, >> the more-then-once-verbose debug log goes onto 'stderr' ? > > a...@yomigaeri:~/projects/opensc/opensc/src/tools$ grep debug_file *.c > opensc-explorer.c: ctx->debug_file = stdout; > opensc-explorer.c: ctx->debug_file = NULL; > pkcs15-init.c: ctx->debug_file = stderr; > > only pkcs15-init.c and opensc-explorer.c set the debug_file. > yes, pkcs15-init will set it to stderr. > > Maybe we should have a uniform handling for all tools? > It is strange if one tool does this, and the others don't. The problem with stderr and stdout is that tools also write independently to those files. What makes it hard to pipe either the output or stderr, if meaningful information from a tool is printed on stderr or the tool should be usable piping stdout "pkcs15-tool -r 1 > cert.pem".
One solution: if debugging is enabled, use stderr for debugging and make the commands print to stdout instead. This assumes that debugging mode is not used in scripts. Another solution: for commands (tools), write the debug output to ./opensc-debug.log by default. > Also: shall we override the setting from opensc.conf? > You can set debug level and debug_file there too. I have two requirements: - it must be possible to set debugging in a configuration file that is used by default (but can be overridden by tools or environment variables) - the user (or some software) must be able to easily locate the debug file set in the configuration file, no matter what is the working directory of the running application that uses PKCS#11 or CDSA. For example on OS X, the Tokend is started with different permissions as a separate user (like "scard" group and openct) so Firefox will not be able to write there. -- Martin Paljak http://martin.paljak.pri.ee +3725156495 _______________________________________________ opensc-devel mailing list [email protected] http://www.opensc-project.org/mailman/listinfo/opensc-devel
