diff --git a/examples/logging/Makefile b/examples/logging/Makefile
new file mode 100644
index 0000000..dfc95be
--- /dev/null
+++ b/examples/logging/Makefile
@@ -0,0 +1,25 @@
+TEE ?= 2>&1 | tee
+
+default: 00 01 02 03 04 05
+
+
+00: dst
+	python run.py -h $(TEE) dst/$@help-message.output
+01: dst
+	python run.py $(TEE) dst/$@run.output
+02: dst
+	DEBUG=1 python run.py $(TEE) dst/$@run-with-debug.output
+03: dst
+	python -m handofcats def.py:run $(TEE) dst/$@run-from-handofcats.output
+04: dst
+	DEBUG=1 python -m handofcats def.py:run $(TEE) dst/$@run-from-handofcats-with-debug.output
+05: FORMAT ?= {"level": "%(levelname)s", "funcname": "%(funcName)s", "message": "%(message)r"}
+05: dst
+	LOGGIG_FORMAT=stdout LOGGING_FORMAT='${FORMAT}' DEBUG=1 python -m handofcats def.py:run $(TEE) dst/$@run-from-handofcats-with-format.output
+
+clean:
+	rm -rf dst
+.PHONY: clean
+
+dst:
+	mkdir -p dst
diff --git a/examples/logging/def.py b/examples/logging/def.py
new file mode 100644
index 0000000..6a71060
--- /dev/null
+++ b/examples/logging/def.py
@@ -0,0 +1,18 @@
+import logging
+
+logger = logging.getLogger(__name__)
+
+
+def run(ok: bool):
+    logger.debug(""""debug" logger's message""")
+    logger.info(""""info" logger's message""")
+    logger.warning(""""warning" logger's message""")
+    logger.error(""""error" logger's message""")
+    logger.critical(""""critical" logger's message""")
+
+    logger.info("""
+MULTILINE MESSAGE
+
+- hello
+- byebye
+""")
diff --git a/examples/logging/dst/00help-message.output b/examples/logging/dst/00help-message.output
new file mode 100644
index 0000000..c05f55d
--- /dev/null
+++ b/examples/logging/dst/00help-message.output
@@ -0,0 +1,12 @@
+usage: run.py [-h] [--expose] [--inplace] [--typed]
+              [--logging {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}]
+
+positional arguments:
+  ok
+
+optional arguments:
+  -h, --help            show this help message and exit
+  --expose
+  --inplace
+  --typed
+  --logging {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}
diff --git a/examples/logging/dst/01run.output b/examples/logging/dst/01run.output
new file mode 100644
index 0000000..5108549
--- /dev/null
+++ b/examples/logging/dst/01run.output
@@ -0,0 +1,3 @@
+warning message
+error message
+critical message
diff --git a/examples/logging/dst/02run-with-debug.output b/examples/logging/dst/02run-with-debug.output
new file mode 100644
index 0000000..000ef4f
--- /dev/null
+++ b/examples/logging/dst/02run-with-debug.output
@@ -0,0 +1,6 @@
+level:DEBUG	name:__main__	where:run.py:9	relative:22.790908813476562	message:debug message
+level:INFO	name:__main__	where:run.py:10	relative:22.938966751098633	message:info message
+level:WARNING	name:__main__	where:run.py:11	relative:23.00715446472168	message:warning message
+level:ERROR	name:__main__	where:run.py:12	relative:23.107051849365234	message:error message
+level:CRITICAL	name:__main__	where:run.py:13	relative:23.19812774658203	message:critical message
+** handofcats.injectlogging: DEBUG=1, activate logging **
diff --git a/examples/logging/dst/03run-from-handofcats.output b/examples/logging/dst/03run-from-handofcats.output
new file mode 100644
index 0000000..454dda6
--- /dev/null
+++ b/examples/logging/dst/03run-from-handofcats.output
@@ -0,0 +1,3 @@
+"warning" logger's message
+"error" logger's message
+"critical" logger's message
diff --git a/examples/logging/dst/04run-from-handofcats-with-debug.output b/examples/logging/dst/04run-from-handofcats-with-debug.output
new file mode 100644
index 0000000..e9d8683
--- /dev/null
+++ b/examples/logging/dst/04run-from-handofcats-with-debug.output
@@ -0,0 +1,12 @@
+level:DEBUG	name:def	where:def.py:7	relative:26.09419822692871	message:"debug" logger's message
+level:INFO	name:def	where:def.py:8	relative:26.311159133911133	message:"info" logger's message
+level:WARNING	name:def	where:def.py:9	relative:26.42822265625	message:"warning" logger's message
+level:ERROR	name:def	where:def.py:10	relative:26.506900787353516	message:"error" logger's message
+level:CRITICAL	name:def	where:def.py:11	relative:26.61919593811035	message:"critical" logger's message
+level:INFO	name:def	where:def.py:13	relative:26.7331600189209	message:
+MULTILINE MESSAGE
+
+- hello
+- byebye
+
+** handofcats.injectlogging: DEBUG=1, activate logging **
diff --git a/examples/logging/dst/05run-from-handofcats-with-format.output b/examples/logging/dst/05run-from-handofcats-with-format.output
new file mode 100644
index 0000000..2c204b2
--- /dev/null
+++ b/examples/logging/dst/05run-from-handofcats-with-format.output
@@ -0,0 +1,7 @@
+{"level": "DEBUG", "funcname": "run", "message": "'"debug" logger\'s message'"}
+{"level": "INFO", "funcname": "run", "message": "'"info" logger\'s message'"}
+{"level": "WARNING", "funcname": "run", "message": "'"warning" logger\'s message'"}
+{"level": "ERROR", "funcname": "run", "message": "'"error" logger\'s message'"}
+{"level": "CRITICAL", "funcname": "run", "message": "'"critical" logger\'s message'"}
+{"level": "INFO", "funcname": "run", "message": "'\nMULTILINE MESSAGE\n\n- hello\n- byebye\n'"}
+** handofcats.injectlogging: DEBUG=1, activate logging **
diff --git a/examples/logging/run.py b/examples/logging/run.py
new file mode 100644
index 0000000..e71c8bc
--- /dev/null
+++ b/examples/logging/run.py
@@ -0,0 +1,13 @@
+from handofcats import as_command
+import logging
+
+logger = logging.getLogger(__name__)
+
+
+@as_command
+def run(ok: bool):
+    logger.debug("debug message")
+    logger.info("info message")
+    logger.warning("warning message")
+    logger.error("error message")
+    logger.critical("critical message")
diff --git a/handofcats/__init__.py b/handofcats/__init__.py
index 5f791f7..b05b919 100644
--- a/handofcats/__init__.py
+++ b/handofcats/__init__.py
@@ -9,7 +9,7 @@ def import_symbol_maybe(ob_or_path, sep=":"):
     return import_symbol(ob_or_path, sep=sep)
 
 
-def as_command(fn=None, argv=None, driver=Driver, level=2, _force=False):
+def as_command(fn=None, *, argv=None, driver=Driver, level=2, _force=False, ignore_logging=False):
     create_driver = import_symbol_maybe(driver)
     if argv is None:
         argv = sys.argv[1:]
@@ -22,7 +22,7 @@ def as_command(fn=None, argv=None, driver=Driver, level=2, _force=False):
             if name != "__main__":
                 return fn
         driver = create_driver()
-        return driver.run(fn, argv)
+        return driver.run(fn, argv, ignore_logging=ignore_logging)
 
     if fn is None:
         return call
diff --git a/handofcats/driver.py b/handofcats/driver.py
index 26c4aab..97c079d 100644
--- a/handofcats/driver.py
+++ b/handofcats/driver.py
@@ -1,4 +1,5 @@
 from .injector import Injector
+from . import injectlogging
 
 
 class Driver:
@@ -30,14 +31,20 @@ class Driver:
             parser.add_argument("--typed", action="store_true")  # xxx (for ./expose.py)
         return parser
 
-    def run(self, fn, argv=None):
+    def run(self, fn, argv=None, *, ignore_logging=False):
         parser = self.create_parser(fn, argv=argv, description=fn.__doc__)
 
         injector = self.create_injector(fn)
         injector.inject(parser)
+        if not ignore_logging:
+            injectlogging.setup(parser)
 
         args = parser.parse_args(argv)
         params = vars(args).copy()
+
+        if not ignore_logging:
+            injectlogging.activate(params)
+
         params.pop("expose", None)  # xxx: for ./parsers/expose.py
         params.pop("inplace", None)  # xxx: for ./parsers/expose.py
         params.pop("typed", None)  # xxx: for ./parsers/expose.py
diff --git a/handofcats/injectlogging.py b/handofcats/injectlogging.py
new file mode 100644
index 0000000..afd600a
--- /dev/null
+++ b/handofcats/injectlogging.py
@@ -0,0 +1,38 @@
+import logging
+import os
+import sys
+
+
+def setup(parser):
+    logging_levels = list(logging._nameToLevel.keys())
+    parser.add_argument(
+        "--logging", choices=logging_levels, default=None
+    )
+
+
+def activate(params, *, logging_level=None, logging_format=None, logging_stream=None):
+    logging_format = (
+        logging_format
+        or "level:%(levelname)s	name:%(name)s	where:%(filename)s:%(lineno)s	relative:%(relativeCreated)s	message:%(message)s"
+    )
+
+    if os.environ.get("DEBUG"):
+        logging_level = logging.DEBUG
+        print("** {where}: DEBUG=1, activate logging **".format(where=__name__))
+
+    if os.environ.get("LOGGING_LEVEL"):
+        logging_level = logging._nameToLevel.get(os.environ["LOGGING_LEVEL"])
+    if os.environ.get("LOGGING_FORMAT"):
+        logging_format = os.environ["LOGGING_FORMAT"]
+    if os.environ.get("LOGGING_STREAM"):
+        logging_stream = getattr(sys, os.environ["LOGGING_STREAM"])
+
+    if "logging" in params:
+        level = params.pop("logging", None)
+        if level is not None:
+            logging_level = level
+
+    if logging_level is not None:
+        logging.basicConfig(
+            level=logging_level, format=logging_format, stream=logging_stream,
+        )

DEBUG=1 logging is activated
diff --git a/handofcats/tests/test_parse.py b/handofcats/tests/test_parse.py
index 42afe45..2e3e8f0 100644
--- a/handofcats/tests/test_parse.py
+++ b/handofcats/tests/test_parse.py
@@ -20,7 +20,7 @@ class Tests(unittest.TestCase):
         class MyDriver(Driver):
             create_parser = testing.create_parser
 
-        return target_function(fn=fn, argv=argv, _force=True, driver=MyDriver)
+        return target_function(fn=fn, argv=argv, _force=True, driver=MyDriver, ignore_logging=True)
 
     def test_it(self):
         from handofcats.parsers.testing import ParseArgsCalled

pip install -e .[dev]
parse_log_pytest
pytest
pytest
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
black==25.1.0
click==8.1.8
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
flake8==7.2.0
-e git+https://github.com/podhmo/handofcats.git@e082e69319329502ca4be097be19fd8304c74d6c#egg=handofcats
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
magicalimport==0.9.1
mccabe==0.7.0
mypy-extensions==1.0.0
packaging @ file:///croot/packaging_1734472117206/work
pathspec==0.12.1
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
prestring==0.9.0
pycodestyle==2.13.0
pyflakes==3.3.1
pytest @ file:///croot/pytest_1738938843180/work
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions==4.13.0

name: handofcats
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - black==25.1.0
      - click==8.1.8
      - flake8==7.2.0
      - magicalimport==0.9.1
      - mccabe==0.7.0
      - mypy-extensions==1.0.0
      - pathspec==0.12.1
      - platformdirs==4.3.7
      - prestring==0.9.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.1
      - typing-extensions==4.13.0
prefix: /opt/conda/envs/handofcats

handofcats/tests/test_parse.py::Tests::test_it
examples/logging/run.py examples/logging/dst/04run-from-handofcats-with-debug.output examples/logging/Makefile examples/logging/dst/03run-from-handofcats.output examples/logging/dst/01run.output examples/logging/dst/05run-from-handofcats-with-format.output handofcats/injectlogging.py examples/logging/dst/02run-with-debug.output handofcats/__init__.py examples/logging/dst/00help-message.output examples/logging/def.py handofcats/driver.py
examples/logging/run.py examples/logging/dst/04run-from-handofcats-with-debug.output examples/logging/Makefile examples/logging/dst/03run-from-handofcats.output examples/logging/dst/01run.output examples/logging/dst/05run-from-handofcats-with-format.output handofcats/injectlogging.py examples/logging/dst/02run-with-debug.output handofcats/__init__.py examples/logging/dst/00help-message.output examples/logging/def.py handofcats/driver.py