A cool logging replacement for Python.

Related tags

Logging logbook
Overview

Welcome to Logbook

Travis Build Status
AppVeyor Build Status
Supported Versions Supported Versions
Latest Version Latest Version
Test Coverage Test Coverage

Logbook is a nice logging replacement.

It should be easy to setup, use and configure and support web applications :)

For more information: http://logbook.readthedocs.org

Comments
  • Skip build option

    Skip build option

    Currently, only certain exceptions are caught before trying to build without speedups. Something in my environment causes ValueError to be raised, which means I can't install logbook.

    Perhaps there should be a way to force skip of the compile step, or ValueError can be checked and raise BuildFailed.

    Collecting logbook
      Using cached Logbook-0.10.0.tar.gz
    Requirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in c:\python34\lib\site-packages (from logbook)
    Installing collected packages: logbook
      Running setup.py install for logbook
        Complete output from command c:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\FRAZER~1\\AppData\\Local\\Temp\\pip-build-kco3r3mt\\logbook\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\FRAZER~1\AppData\Local\Temp\pip-ymatx5nb-record\install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-3.4
        creating build\lib.win-amd64-3.4\logbook
        copying logbook\base.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\compat.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\concurrency.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\handlers.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\helpers.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\more.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\notifiers.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\queues.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\ticketing.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\_fallback.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\_termcolors.py -> build\lib.win-amd64-3.4\logbook
        copying logbook\__init__.py -> build\lib.win-amd64-3.4\logbook
        running build_ext
        building 'logbook._speedups' extension
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "C:\Users\FRAZER~1\AppData\Local\Temp\pip-build-kco3r3mt\logbook\setup.py", line 133, in <module>
            run_setup(True)
          File "C:\Users\FRAZER~1\AppData\Local\Temp\pip-build-kco3r3mt\logbook\setup.py", line 124, in run_setup
            **extra
          File "c:\Python34\lib\distutils\core.py", line 148, in setup
            dist.run_commands()
          File "c:\Python34\lib\distutils\dist.py", line 955, in run_commands
            self.run_command(cmd)
          File "c:\Python34\lib\distutils\dist.py", line 974, in run_command
            cmd_obj.run()
          File "c:\Python34\lib\site-packages\setuptools\command\install.py", line 61, in run
            return orig.install.run(self)
          File "c:\Python34\lib\distutils\command\install.py", line 539, in run
            self.run_command('build')
          File "c:\Python34\lib\distutils\cmd.py", line 313, in run_command
            self.distribution.run_command(command)
          File "c:\Python34\lib\distutils\dist.py", line 974, in run_command
            cmd_obj.run()
          File "c:\Python34\lib\distutils\command\build.py", line 126, in run
            self.run_command(cmd_name)
          File "c:\Python34\lib\distutils\cmd.py", line 313, in run_command
            self.distribution.run_command(command)
          File "c:\Python34\lib\distutils\dist.py", line 974, in run_command
            cmd_obj.run()
          File "C:\Users\FRAZER~1\AppData\Local\Temp\pip-build-kco3r3mt\logbook\setup.py", line 83, in run
            build_ext.run(self)
          File "c:\Python34\lib\distutils\command\build_ext.py", line 339, in run
            self.build_extensions()
          File "c:\Python34\lib\distutils\command\build_ext.py", line 448, in build_extensions
            self.build_extension(ext)
          File "C:\Users\FRAZER~1\AppData\Local\Temp\pip-build-kco3r3mt\logbook\setup.py", line 89, in build_extension
            build_ext.build_extension(self, ext)
          File "c:\Python34\lib\distutils\command\build_ext.py", line 503, in build_extension
            depends=ext.depends)
          File "c:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
            self.initialize()
          File "c:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
            vc_env = query_vcvarsall(VERSION, plat_spec)
          File "c:\Python34\lib\site-packages\setuptools\msvc9_support.py", line 52, in query_vcvarsall
            return unpatched['query_vcvarsall'](version, *args, **kwargs)
          File "c:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
            raise ValueError(str(list(result.keys())))
        ValueError: ['path']
    
    opened by RazerM 14
  • Processors are not called on LogRecords prior to calling Handler filter methods

    Processors are not called on LogRecords prior to calling Handler filter methods

    I have an application in which we use a Processor to conditionally add information to LogRecords. Later on in our pipeline, we filter LogRecords based on information that was added by the Processor. This pattern no longer works as of https://github.com/mitsuhiko/logbook/commit/43a63589b318482edbc990faa079017669b0ff36, because that change moves the check on handler.filter to before the call to self.process_record.

    A simple fix would be to move the call to process_record to happen prior to the filter check in RecordDispatcher.call_handlers, but it's unclear to me whether that's correct because the current implementation is explicitly short-circuiting when blackhole = True, presumably to avoid doing unncessary processing.

    opened by ssanderson 13
  • Release 0.4.2 fails on Python 3 due to byte compilation

    Release 0.4.2 fails on Python 3 due to byte compilation

    in the source, once built.

    sorry, correction here py2.7 imports, py3.2 3.3 don't

    
    logbook-0.4.2 $ PYTHONPATH=. python3.2 -c "from logbook import _stringfmt"
    testuser@archtester /mnt/gen2/TmpDir/portage/dev-python/logbook-0.4.2/work/logbook-0.4.2 $ PYTHONPATH=. python3.1 -c "from logbook import _stringfmt"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "logbook/_stringfmt.py", line 203
        except UnicodeDecodeError, e:
                                 ^
    SyntaxError: invalid syntax
    

    edit to

            try:
                return self._string % params
            except UnicodeDecodeError as e:
    

    then

    logbook-0.4.2 $ PYTHONPATH=. python3.3 -c "from logbook import _stringfmt"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "./logbook/_stringfmt.py", line 19, in <module>
        _integer_classes = (int, long)
    NameError: name 'long' is not defined
    
    logbook-0.4.2 $ PYTHONPATH=. python2.7 -c "from logbook import _stringfmt"
    
    logbook-0.4.2 $ 
    

    It seems py3 is underdone

    opened by idella 12
  • RiemannHandler implementation

    RiemannHandler implementation

    New handler type which allows to push logs to Riemann via TCP or UDP.

    Currently missing: TLS support, and riemann-client (https://github.com/borntyping/python-riemann-client) uses experimental protobuf support for Python 3. However, I haven't got any issues with it.

    opened by zaibacu 11
  • Hints or best practices for filtering in documentation

    Hints or best practices for filtering in documentation

    I'm diving in to Logbook lib and I found it confusing, that there are no examples or hints for records filtering (or they are hard to found?).

    Also it seems that channel names should be just descriptive and human readable, as said in Logger class docs: http://pythonhosted.org/Logbook/api/base.html

    Names used by logbook should be descriptive and are intended for user display, not for filtering.

    But the other part of docs says, on the same page for LogRecord.channel: http://pythonhosted.org/Logbook/api/base.html#logbook.LogRecord

    the name of the logger that created it or any other textual channel description. This is a descriptive name and can be used for filtering.

    So, are there any real practices with that? How is it intended to be finally by design? I think I will be able to provide some examples of 'real usage', but I need first to understand that by myself :)

    Thank you for the Logbook!

    opened by rudyryk 11
  • Enable set_datetime_format to take a user-supplied factory function

    Enable set_datetime_format to take a user-supplied factory function

    Switching between utc and local timestamps is all well and good, but for proper correlation of logs between sources, the inclusion of a timezone makes things a lot easier to follow. This PR enables that in a (I think) backwards compatible way:

    • Add %z to the default format string (%z is safe in that it will include an empty string for LogRecord.time without a time zone);
    • Enable user-supplied datetime factory for logbook.set_datetime_format as long as it provides datetime.datetime instances.

    I :heart: logbook with all my :heart:, but this one's been bugging me for a while. Using a simple wrapper, I get 'nice' (well, for me) messages including the time zone like +0000 for UTC:

    def utc_tz():
        return datetime.now(tz=timezone.utc)
    
    logbook.set_datetime_format(utc_tz)
    
    logbook.info('I am now logging with time zone aware timestamps! :o')
    
    [2016-05-09 14:54:32.925248+0000] INFO: Generic: I am now logging with time zone aware timestamps! :o
    
    opened by akaIDIOT 10
  • Forward batched emits in ThreadedWrapperHandler

    Forward batched emits in ThreadedWrapperHandler

    Resolves #283.

    Note: I have not tested if the changes to TWHThreadController have a negative performance impact since it introduces some tuple unpacking.

    Probably more importantly I've changed the call from .handle to .emit. I'm not sure if that's acceptable.

    opened by lgrahl 9
  • complete example of logbook with multiprocessing

    complete example of logbook with multiprocessing

    Hello, Would someone point me to a small complete example for setting up logbook to a file shared among processes? I am trying to build a standalone app using python 3.5

    Thanks

    opened by jeffreyscottgraham 9
  • Remove the default global handler

    Remove the default global handler

    This is a tough one.

    One of the problems with Logbook today that is hindering its adoption is, in my opinion, the default global handler.

    While very useful for quick apps or webapps, it is an annoyance to library developers -- each library explicitly or implicitly using Logbook means output to stderr by default.

    Given the fact that setting up logbook is so easy (especially compared to basicConfig), I think dropping the default global handler is a wise move. Application seeking to add it back need a single line in their if __name__ == 'main' section, while libraries can rest assured that they don't litter the screen by default.

    However I won't go forward making the change before I hear some more opinions about it - @brainstorm or anyone else, please let me know what you think...

    opened by vmalloc 9
  • testsuite errors of -0.7.0

    testsuite errors of -0.7.0

    from the actual source running nosetests

    /logbook-0.7.0 $ nosetests
    /usr/lib64/python3.3/site-packages/nose/plugins/manager.py:395: RuntimeWarning: Unable to load plugin html-output = htmloutput.htmloutput:HtmlOutput: No module named 'version'
      RuntimeWarning)
    ....................................................................................................S..E.............E
    ======================================================================
    ERROR: test_redis_handler (tests.test_logbook.QueuesTestCase)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 250, in connect
        sock = self._connect()
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 268, in _connect
        self.socket_timeout)
      File "/usr/lib64/python3.3/socket.py", line 435, in create_connection
        raise err
      File "/usr/lib64/python3.3/socket.py", line 426, in create_connection
        sock.connect(sa)
    ConnectionRefusedError: [Errno 111] Connection refused
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib64/python3.3/site-packages/redis/client.py", line 460, in execute_command
        connection.send_command(*args)
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 334, in send_command
        self.send_packed_command(self.pack_command(*args))
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 316, in send_packed_command
        self.connect()
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 253, in connect
        raise ConnectionError(self._error_message(e))
    redis.exceptions.ConnectionError: Error 111 connecting 127.0.0.1:6379. Connection refused.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 250, in connect
        sock = self._connect()
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 268, in _connect
        self.socket_timeout)
      File "/usr/lib64/python3.3/socket.py", line 435, in create_connection
        raise err
      File "/usr/lib64/python3.3/socket.py", line 426, in create_connection
        sock.connect(sa)
    ConnectionRefusedError: [Errno 111] Connection refused
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/mnt/gen2/TmpDir/portage/dev-python/logbook-0.7.0/work/logbook-0.7.0/tests/test_logbook.py", line 1300, in test_redis_handler
        redis_handler = RedisHandler(level=logbook.INFO, bubble=True)
      File "/mnt/gen2/TmpDir/portage/dev-python/logbook-0.7.0/work/logbook-0.7.0/logbook/queues.py", line 58, in __init__
        self.redis.ping()
      File "/usr/lib64/python3.3/site-packages/redis/client.py", line 564, in ping
        return self.execute_command('PING')
      File "/usr/lib64/python3.3/site-packages/redis/client.py", line 464, in execute_command
        connection.send_command(*args)
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 334, in send_command
        self.send_packed_command(self.pack_command(*args))
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 316, in send_packed_command
        self.connect()
      File "/usr/lib64/python3.3/site-packages/redis/connection.py", line 253, in connect
        raise ConnectionError(self._error_message(e))
    redis.exceptions.ConnectionError: Error 111 connecting 127.0.0.1:6379. Connection refused.
    
    ======================================================================
    ERROR: Failure: RuntimeError (NTLogEventLogHandler requires a Windows operating system.)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib64/python3.3/site-packages/nose/failure.py", line 39, in runTest
        raise self.exc_val.with_traceback(self.tb)
      File "/usr/lib64/python3.3/site-packages/nose/loader.py", line 414, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib64/python3.3/site-packages/nose/importer.py", line 47, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib64/python3.3/site-packages/nose/importer.py", line 94, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/usr/lib64/python3.3/imp.py", line 180, in load_module
        return load_source(name, filename, file)
      File "/usr/lib64/python3.3/imp.py", line 119, in load_source
        _LoadSourceCompatibility(name, pathname, file).load_module(name)
      File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
      File "<frozen importlib._bootstrap>", line 1022, in load_module
      File "<frozen importlib._bootstrap>", line 1003, in load_module
      File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
      File "<frozen importlib._bootstrap>", line 868, in _load_module
      File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
      File "/mnt/gen2/TmpDir/portage/dev-python/logbook-0.7.0/work/logbook-0.7.0/testwin32log.py", line 4, in <module>
        handler = NTEventLogHandler('My Application')
      File "/mnt/gen2/TmpDir/portage/dev-python/logbook-0.7.0/work/logbook-0.7.0/logbook/handlers.py", line 1394, in __init__
        raise RuntimeError('NTLogEventLogHandler requires a Windows '
    RuntimeError: NTLogEventLogHandler requires a Windows operating system.
    
    ----------------------------------------------------------------------
    Ran 118 tests in 3.542s
    
    FAILED (SKIP=1, errors=2)
    

    Same for all python versions. Do you require anything further, vmalloc?

    opened by idella 9
  • Handler for SQS

    Handler for SQS

    This is a basic handler for AWS' SQS.

    The motivation behind it is to prevent log files on disk from making our instances stateful, and to make use of what Amazon already gives us at a very low cost without needing to set up RabbitMQ, etc.

    opened by dzderic 9
  • Fix setuptools warning about

    Fix setuptools warning about "upload-dir"

    Fixes the following warning: Usage of dash-separated 'upload-dir' will not be supported in future versions. Please use the underscore name 'upload_dir' instead

    opened by ZeroPointEnergy 0
  • 1.5.3: pep517 build issue

    1.5.3: pep517 build issue

    I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

    • python3 -sBm build -w --no-isolation
    • because I'm calling build with --no-isolation I'm using during all processes oly locally installed modules

    Looks like there is no proper procedure to generate logbook/_speedups.c. Here is the build output:

    + /usr/bin/python3 -sBm build -w --no-isolation
    * Getting dependencies for wheel...
    /usr/lib/python3.8/site-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'upload-dir' will not be supported in future versions. Please use the underscore name 'upload_dir' instead
      warnings.warn(
    running egg_info
    creating Logbook.egg-info
    writing manifest file 'Logbook.egg-info/SOURCES.txt'
    warning: no files found matching 'logbook/_speedups.c'
    writing manifest file 'Logbook.egg-info/SOURCES.txt'
    * Building wheel...
    /usr/lib/python3.8/site-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'upload-dir' will not be supported in future versions. Please use the underscore name 'upload_dir' instead
      warnings.warn(
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/logbook
    copying logbook/__init__.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/__version__.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/_fallback.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/_termcolors.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/base.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/compat.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/concurrency.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/handlers.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/helpers.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/more.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/notifiers.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/queues.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/ticketing.py -> build/lib.linux-x86_64-3.8/logbook
    copying logbook/utils.py -> build/lib.linux-x86_64-3.8/logbook
    running build_ext
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/logbook
    /usr/bin/gcc -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -fPIC -I/usr/include/python3.8 -c logbook/_speedups.c -o build/temp.linux-x86_64-3.8/logbook/_speedups.o
    cc1: fatal error: logbook/_speedups.c: No such file or directory
    compilation terminated.
    ***************************************************************************
    command '/usr/bin/gcc' failed with exit code 1
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.
    ***************************************************************************
    running bdist_wheel
    running build
    running build_py
    running build_ext
    running install
    running install_lib
    creating build/bdist.linux-x86_64
    creating build/bdist.linux-x86_64/wheel
    creating build/bdist.linux-x86_64/wheel/logbook
    running install_egg_info
    running egg_info
    warning: no files found matching 'logbook/_speedups.c'
    writing manifest file 'Logbook.egg-info/SOURCES.txt'
    Copying Logbook.egg-info to build/bdist.linux-x86_64/wheel/Logbook-1.5.3-py3.8.egg-info
    running install_scripts
    ***************************************************************************
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Plain-Python build succeeded.
    ***************************************************************************
    Successfully built Logbook-1.5.3-cp38-cp38-linux_x86_64.whl
    
    opened by kloczek 1
  • 1.5.3: sphinx warnings

    1.5.3: sphinx warnings

    + /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
    /usr/lib/python3.8/site-packages/setuptools/dist.py:697: UserWarning: Usage of dash-separated 'upload-dir' will not be supported in future versions. Please use the underscore name 'upload_dir' instead
      warnings.warn(
    running build_sphinx
    Running Sphinx v4.1.2
    making output directory... done
    loading intersphinx inventory from http://docs.python.org/objects.inv...
    intersphinx inventory has moved: http://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
    building [mo]: all of 0 po files
    building [man]: all source files
    updating environment: [new config] 24 added, 0 changed, 0 removed
    reading sources... [100%] unittesting
    /home/tkloczko/rpmbuild/BUILD/logbook-1.5.3/docs/api/handlers.rst:9: WARNING: duplicate object description of logbook, other instance in api/base, use :noindex: for one of them
    /home/tkloczko/rpmbuild/BUILD/logbook-1.5.3/docs/api/utilities.rst:9: WARNING: duplicate object description of logbook, other instance in api/handlers, use :noindex: for one of them
    looking for now-outdated files... none found
    pickling environment... done
    checking consistency... done
    writing... python-logbook.3 { features quickstart setups stacks performance libraries unittesting ticketing compat api/index api/base api/handlers api/utilities api/queues api/ticketing api/more api/notifiers api/compat api/internal designexplained designdefense cookbook changelog } done
    build succeeded, 2 warnings.
    
    opened by kloczek 0
  • 1.5.3: pytest is failing

    1.5.3: pytest is failing

    I'm trying to package your module as rpm packag. So I'm using typical in such case build, install and test cycle used on building package from non-root account:

    • "setup.py build"
    • "setup.py install --root </install/prefix>"
    • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

    May I ask for help because few units are failing:

    + /usr/bin/pytest -ra
    1549013:C 14 Aug 2021 09:10:05.214 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    1549013:C 14 Aug 2021 09:10:05.214 # Redis version=6.2.2, bits=64, commit=00000000, modified=0, pid=1549013, just started
    1549013:C 14 Aug 2021 09:10:05.215 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
    1549013:M 14 Aug 2021 09:10:05.216 * Increased maximum number of open files to 10032 (it was originally set to 1024).
    1549013:M 14 Aug 2021 09:10:05.216 * monotonic clock: POSIX clock_gettime
                    _._
               _.-``__ ''-._
          _.-``    `.  `_.  ''-._           Redis 6.2.2 (00000000/0) 64 bit
      .-`` .-```.  ```\/    _.,_ ''-._
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 1549013
      `-._    `-._  `-./  _.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |           https://redis.io
      `-._    `-._`-.__.-'_.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |
      `-._    `-._`-.__.-'_.-'    _.-'
          `-._    `-.__.-'    _.-'
              `-._        _.-'
                  `-.__.-'
    
    1549013:M 14 Aug 2021 09:10:05.217 # Server initialized
    1549013:M 14 Aug 2021 09:10:05.217 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    1549013:M 14 Aug 2021 09:10:05.219 * Ready to accept connections
    =========================================================================== test session starts ============================================================================
    platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
    benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
    rootdir: /home/tkloczko/rpmbuild/BUILD/logbook-1.5.3
    plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0, asyncio-0.15.1, trio-0.7.0, httpbin-1.0.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0
    collected 428 items
    
    . .                                                                                                                                                                  [  0%]
    tests/test_asyncio.py .F                                                                                                                                             [  0%]
    tests/test_ci.py ssss                                                                                                                                                [  1%]
    tests/test_deadlock.py ..                                                                                                                                            [  2%]
    tests/test_file_handler.py ................................................................                                                                          [ 17%]
    tests/test_fingers_crossed_handler.py ............                                                                                                                   [ 19%]
    tests/test_flags.py ....                                                                                                                                             [ 20%]
    tests/test_groups.py ....                                                                                                                                            [ 21%]
    tests/test_handler_errors.py ......                                                                                                                                  [ 23%]
    tests/test_handlers.py ......................                                                                                                                        [ 28%]
    tests/test_helpers.py ....                                                                                                                                           [ 29%]
    tests/test_log_record.py ....................                                                                                                                        [ 33%]
    tests/test_logbook.py ......                                                                                                                                         [ 35%]
    tests/test_logger.py ......                                                                                                                                          [ 36%]
    tests/test_logging_api.py ..........................                                                                                                                 [ 42%]
    tests/test_logging_compat.py ........                                                                                                                                [ 44%]
    tests/test_logging_times.py ..........                                                                                                                               [ 47%]
    tests/test_mail_handler.py ..............                                                                                                                            [ 50%]
    tests/test_more.py .........sss.........sss                                                                                                                          [ 55%]
    tests/test_nteventlog_handler.py ss                                                                                                                                  [ 56%]
    tests/test_null_handler.py ............                                                                                                                              [ 59%]
    tests/test_processors.py ........                                                                                                                                    [ 61%]
    tests/test_queues.py ............................                                                                                                                    [ 67%]
    tests/test_syslog_handler.py ........................                                                                                                                [ 73%]
    tests/test_test_handler.py ............................................................                                                                              [ 87%]
    tests/test_ticketing.py FF                                                                                                                                           [ 87%]
    tests/test_unicode.py ..............                                                                                                                                 [ 91%]
    tests/test_utils.py ......................................                                                                                                           [100%]
    
    ================================================================================= FAILURES =================================================================================
    __________________________________________________________________ test_asyncio_context_management[True] ___________________________________________________________________
    
    logger = <logbook.base.Logger object at 0x7fc58ec66340>
    
        @pytest.mark.skipif(not has_contextvars, reason="Contexvars not available")
        def test_asyncio_context_management(logger):
            h1 = logbook.TestHandler()
            h2 = logbook.TestHandler()
    
            async def task(handler, msg):
                for _ in range(ITERATIONS):
                    with handler.contextbound():
                        logger.info(msg)
    
                    await asyncio.sleep(0)  # allow for context switch
    
            asyncio.get_event_loop().run_until_complete(asyncio.gather(task(h1, 'task1'), task(h2, 'task2')))
    
    >       assert len(h1.records) == ITERATIONS
    E       assert 200 == 100
    E        +  where 200 = len([<logbook.base.LogRecord object at 0x7fc58eb443a0>, <logbook.base.LogRecord object at 0x7fc58eb44430>, <logbook.base.L...c58eb445b0>, <logbook.base.LogRecord object at 0x7fc58eb44640>, <logbook.base.LogRecord object at 0x7fc58eb446d0>, ...])
    E        +    where [<logbook.base.LogRecord object at 0x7fc58eb443a0>, <logbook.base.LogRecord object at 0x7fc58eb44430>, <logbook.base.L...c58eb445b0>, <logbook.base.LogRecord object at 0x7fc58eb44640>, <logbook.base.LogRecord object at 0x7fc58eb446d0>, ...] = <logbook.handlers.TestHandler object at 0x7fc58ec663d0>.records
    
    tests/test_asyncio.py:23: AssertionError
    _______________________________________________________________________ test_basic_ticketing[False] ________________________________________________________________________
    
    logger = <logbook.base.Logger object at 0x7fc58e8f29a0>
    
        @pytest.mark.xfail(
            os.name == 'nt' and (python_version == (3, 2) or python_version == (3, 3)),
            reason='Problem with in-memory sqlite on Python 3.2, 3.3 and Windows')
        @require_module('sqlalchemy')
        def test_basic_ticketing(logger):
            from logbook.ticketing import TicketingHandler
            from time import sleep
            with TicketingHandler('sqlite:///') as handler:
                for x in xrange(5):
                    logger.warn('A warning')
                    sleep(0.2)
                    logger.info('An error')
                    sleep(0.2)
                    if x < 2:
                        try:
                            1 / 0
                        except Exception:
                            logger.exception()
    
    >       assert handler.db.count_tickets() == 3
    
    tests/test_ticketing.py:41:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <logbook.ticketing.SQLAlchemyBackend object at 0x7fc58e8f2550>
    
        def count_tickets(self):
            """Returns the number of tickets."""
    >       return self.engine.execute(self.tickets.count()).fetchone()[0]
    E       AttributeError: 'Table' object has no attribute 'count'
    
    logbook/ticketing.py:246: AttributeError
    ________________________________________________________________________ test_basic_ticketing[True] ________________________________________________________________________
    
    logger = <logbook.base.Logger object at 0x7fc5ba958430>
    
        @pytest.mark.xfail(
            os.name == 'nt' and (python_version == (3, 2) or python_version == (3, 3)),
            reason='Problem with in-memory sqlite on Python 3.2, 3.3 and Windows')
        @require_module('sqlalchemy')
        def test_basic_ticketing(logger):
            from logbook.ticketing import TicketingHandler
            from time import sleep
            with TicketingHandler('sqlite:///') as handler:
                for x in xrange(5):
                    logger.warn('A warning')
                    sleep(0.2)
                    logger.info('An error')
                    sleep(0.2)
                    if x < 2:
                        try:
                            1 / 0
                        except Exception:
                            logger.exception()
    
    >       assert handler.db.count_tickets() == 3
    
    tests/test_ticketing.py:41:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <logbook.ticketing.SQLAlchemyBackend object at 0x7fc5ba958490>
    
        def count_tickets(self):
            """Returns the number of tickets."""
    >       return self.engine.execute(self.tickets.count()).fetchone()[0]
    E       AttributeError: 'Table' object has no attribute 'count'
    
    logbook/ticketing.py:246: AttributeError
    ============================================================================= warnings summary =============================================================================
    tests/test_queues.py::test_missing_zeromq[False]
    tests/test_queues.py::test_missing_zeromq[True]
      /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function ZeroMQHandler.__del__ at 0x7fc58e9189d0>
    
      Traceback (most recent call last):
        File "/home/tkloczko/rpmbuild/BUILD/logbook-1.5.3/logbook/queues.py", line 241, in __del__
          self.close(linger=100)
        File "/home/tkloczko/rpmbuild/BUILD/logbook-1.5.3/logbook/queues.py", line 232, in close
          self.socket.close(linger)
      AttributeError: 'ZeroMQHandler' object has no attribute 'socket'
    
        warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    
    tests/test_ticketing.py::test_basic_ticketing[False]
    tests/test_ticketing.py::test_basic_ticketing[True]
      /home/tkloczko/rpmbuild/BUILD/logbook-1.5.3/logbook/ticketing.py:147: SADeprecationWarning: The create_engine.convert_unicode parameter and corresponding dialect-level parameters are deprecated, and will be removed in a future release.  Modern DBAPIs support Python Unicode natively and this parameter is unnecessary.
        self.engine = create_engine(engine_or_uri, convert_unicode=True,
    
    -- Docs: https://docs.pytest.org/en/stable/warnings.html
    ========================================================================= short test summary info ==========================================================================
    SKIPPED [2] tests/test_ci.py:8: AppVeyor CI test
    SKIPPED [2] tests/test_ci.py:16: Travis CI test
    SKIPPED [2] tests/test_more.py:166: Module riemann_client is required
    SKIPPED [2] tests/test_more.py:189: Module riemann_client is required
    SKIPPED [2] tests/test_more.py:195: Module riemann_client is required
    SKIPPED [2] tests/test_nteventlog_handler.py:9: Don't clutter NT Event Log unless enabled.
    FAILED tests/test_asyncio.py::test_asyncio_context_management[True] - assert 200 == 100
    FAILED tests/test_ticketing.py::test_basic_ticketing[False] - AttributeError: 'Table' object has no attribute 'count'
    FAILED tests/test_ticketing.py::test_basic_ticketing[True] - AttributeError: 'Table' object has no attribute 'count'
    ========================================================== 3 failed, 412 passed, 12 skipped, 4 warnings in 33.27s ==========================================================
    pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
    
    opened by kloczek 1
Releases(1.0.0)
Python logging made (stupidly) simple

Loguru is a library which aims to bring enjoyable logging in Python. Did you ever feel lazy about configuring a logger and used print() instead?... I

null 13.7k Jan 2, 2023
Structured Logging for Python

structlog makes logging in Python faster, less painful, and more powerful by adding structure to your log entries. It's up to you whether you want str

Hynek Schlawack 2.3k Jan 5, 2023
A colored formatter for the python logging module

Log formatting with colors! colorlog.ColoredFormatter is a formatter for use with Python's logging module that outputs records using terminal colors.

Sam Clements 778 Dec 26, 2022
Colored terminal output for Python's logging module

coloredlogs: Colored terminal output for Python's logging module The coloredlogs package enables colored terminal output for Python's logging module.

Peter Odding 496 Dec 30, 2022
Robust and effective logging for Python 2 and 3.

Robust and effective logging for Python 2 and 3.

Chris Hager 1k Jan 4, 2023
Python logging package for easy reproducible experimenting in research

smilelogging Python logging package for easy reproducible experimenting in research. Why you may need this package This project is meant to provide an

Huan Wang 20 Dec 23, 2022
A basic logging library for Python.

log.py ?? About: A basic logging library for Python with the capability to: save to files. have custom formats. have custom levels. be used instantiat

Sebastiaan Bij 1 Jan 19, 2022
Small toolkit for python multiprocessing logging to file

Small Toolkit for Python Multiprocessing Logging This is a small toolkit for solving unsafe python mutliprocess logging (file logging and rotation) In

Qishuai 1 Nov 10, 2021
Beautifully colored, quick and simple Python logging

Python Quick Logging | QLogging Beautifully colored, quick and simple Python logging. This logger is based on Python logging package Screenshots: Term

null 45 Sep 25, 2022
A lightweight logging library for python applications

cakelog a lightweight logging library for python applications This is a very small logging library to make logging in python easy and simple. config o

null 2 Jan 5, 2022
Simple and versatile logging library for python 3.6 above

Simple and versatile logging library for python 3.6 above

Miguel 1 Nov 23, 2022
A Python package which supports global logfmt formatted logging.

Python Logfmter A Python package which supports global logfmt formatted logging. Install $ pip install logfmter Usage Before integrating this library,

Joshua Taylor Eppinette 15 Dec 29, 2022
Stand-alone parser for User Access Logging from Server 2012 and newer systems

KStrike Stand-alone parser for User Access Logging from Server 2012 and newer systems BriMor Labs KStrike This script will parse data from the User Ac

BriMor Labs 69 Nov 1, 2022
Logging system for the TPC software.

tpc_logger Logging system for the TPC software. The TPC Logger class provides a singleton for logging information within C++ code or in the python API

UC Davis Machine Learning 1 Jan 10, 2022
Outlog it's a library to make logging a simple task

outlog Outlog it's a library to make logging a simple task!. I'm a lazy python user, the times that i do logging on my apps it's hard to do, a lot of

ZSendokame 2 Mar 5, 2022
metovlogs is a very simple logging library

metovlogs is a very simple logging library. Setup is one line, then you can use it as a drop-in print replacement. Sane and useful log format out of the box. Best for small or early projects.

Azat Akhmetov 1 Mar 1, 2022
Pretty-print tabular data in Python, a library and a command-line utility. Repository migrated from bitbucket.org/astanin/python-tabulate.

python-tabulate Pretty-print tabular data in Python, a library and a command-line utility. The main use cases of the library are: printing small table

Sergey Astanin 1.5k Jan 6, 2023
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"

Text progress bar library for Python. Travis status: Coverage: Install The package can be installed through pip (this is the recommended method): pip

Rick van Hattem 795 Dec 18, 2022
The new Python SDK for Sentry.io

sentry-python - Sentry SDK for Python This is the next line of the Python SDK for Sentry, intended to replace the raven package on PyPI. from sentry_s

Sentry 1.4k Dec 31, 2022