Hi,

try removing the line

    logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

Logging setup is already done on daemon startup to the appropriate files,
not per-module. (Also you're redirecting to the standard output, but
daemons usually don't have one that would be visible anywhere.)

  Cheers,
  Petr

On Tue, Apr 21, 2015 at 12:22 PM, Gangbiao Liu <[email protected]> wrote:

> On Tue, Apr 21, 2015 at 5:17 PM, Petr Pudlák <[email protected]> wrote:
> > Hi,
>
> Hi Petr,
>
> >
> > in Ganeti we never use 'print', you need to use the logging framework to
> see
> > messages in appropriate logs. Look for 'logging.debug', 'logging.info'
> etc.
> > calls in the code to see how logging is used in Ganeti.
> >
>
> Actually, I have also tried logging.info and logging.debug as follows
>
> diff --git a/lib/storage/filestorage.py b/lib/storage/filestorage.py
> index 0e37d59..8910313 100644
> --- a/lib/storage/filestorage.py
> +++ b/lib/storage/filestorage.py
> @@ -35,6 +35,7 @@
>  import logging
>  import errno
>  import os
> +import sys
>
>  from ganeti import compat
>  from ganeti import constants
> @@ -44,6 +45,7 @@ from ganeti import utils
>  from ganeti.utils import io
>  from ganeti.storage import base
>
> +logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
>
>  class FileDeviceHelper(object):
>
> @@ -436,6 +438,8 @@ def CheckFileStoragePathAcceptance(
>                                        " was not accessible." % _filename)
>
>    if _ComputeWrongFileStoragePaths([path]):
> +    logging.info('Path is %s', path)
> +    logging.debug('Path is %s', path)
>      raise errors.FileStoragePathError("Path '%s' uses a forbidden prefix"
> %
>                                        path)
>
>
> However, I cannot still get any log messages (I added above) from
> stdout or log files under /var/log/ganeti. I find 'doc/design-2.0.rst'
> says logging system of Ganeti will be switched completely to the
> standard python logging module so I use above way. Currently, I find
> other parts of Ganeti have realized/used Log/LogInfo/LogWarning/...
> APIs. Let me see how to use them.
>
>
> Cheers, Gangbiao
>

Reply via email to