diff --git a/charms/reactive/bus.py b/charms/reactive/bus.py
index 885e498..1bd1364 100644
--- a/charms/reactive/bus.py
+++ b/charms/reactive/bus.py
@@ -170,12 +170,16 @@ def get_state(state, default=None):
 
 
 def _action_id(action):
+    if hasattr(action, '_action_id'):
+        return action._action_id
     return "%s:%s:%s" % (action.__code__.co_filename,
                          action.__code__.co_firstlineno,
                          action.__code__.co_name)
 
 
 def _short_action_id(action):
+    if hasattr(action, '_short_action_id'):
+        return action._short_action_id
     filepath = os.path.relpath(action.__code__.co_filename, hookenv.charm_dir())
     return "%s:%s:%s" % (filepath,
                          action.__code__.co_firstlineno,
diff --git a/charms/reactive/decorators.py b/charms/reactive/decorators.py
index 7918106..7de571c 100644
--- a/charms/reactive/decorators.py
+++ b/charms/reactive/decorators.py
@@ -21,6 +21,7 @@ from charmhelpers.core import hookenv
 from charms.reactive.bus import Handler
 from charms.reactive.bus import get_states
 from charms.reactive.bus import _action_id
+from charms.reactive.bus import _short_action_id
 from charms.reactive.relations import RelationBase
 from charms.reactive.helpers import _hook
 from charms.reactive.helpers import _when_all
@@ -188,19 +189,21 @@ def not_unless(*desired_states):
     This is primarily for informational purposes and as a guard clause.
     """
     def _decorator(func):
+        action_id = _action_id(func)
+        short_action_id = _short_action_id(func)
+
         @wraps(func)
         def _wrapped(*args, **kwargs):
             active_states = get_states()
             missing_states = [state for state in desired_states if state not in active_states]
             if missing_states:
-                func_id = "%s:%s:%s" % (func.__code__.co_filename,
-                                        func.__code__.co_firstlineno,
-                                        func.__code__.co_name)
                 hookenv.log('%s called before state%s: %s' % (
-                    func_id,
+                    short_action_id,
                     's' if len(missing_states) > 1 else '',
                     ', '.join(missing_states)), hookenv.WARNING)
             return func(*args, **kwargs)
+        _wrapped._action_id = action_id
+        _wrapped._short_action_id = short_action_id
         return _wrapped
     return _decorator
 

Incorrect handler name logged using not_unless decorator
I'm getting the following in my logs:

2016-01-11 14:58:37 INFO juju-log replication:1: Invoking reactive handler: lib/pypi/charms/reactive/decorators.py:149:_wrapped

It looks like a name isn't being copied from the wrapped function in the not_unless decorator
diff --git a/tests/test_decorators.py b/tests/test_decorators.py
index 4691a30..78733c7 100644
--- a/tests/test_decorators.py
+++ b/tests/test_decorators.py
@@ -236,6 +236,10 @@ class TestReactiveDecorators(unittest.TestCase):
         self.assertEqual(action.call_count, 3)
         assert log_msg(0).endswith('test called before states: foo, bar'), log_msg(0)
         assert log_msg(1).endswith('test called before state: bar'), log_msg(1)
+        self.assertIn('tests/test_decorators.py:', reactive.bus._action_id(test))
+        self.assertIn(':test', reactive.bus._action_id(test))
+        self.assertIn('tests/test_decorators.py:', reactive.bus._short_action_id(test))
+        self.assertIn(':test', reactive.bus._short_action_id(test))
 
     def test_only_once(self):
         calls = []

pip install -e .
parse_log_pytest
requirements.txt
coverage mock nose flake8 ipython ipdb pytest
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
backcall==0.2.0
certifi==2021.5.30
charmhelpers==1.2.1
-e git+https://github.com/juju-solutions/charms.reactive.git@04663e45f3683d4c497f43526d3ac26593ee10a2#egg=charms.reactive
coverage==6.2
decorator==5.1.1
flake8==5.0.4
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
ipdb==0.13.13
ipython==7.16.3
ipython-genutils==0.2.0
jedi==0.17.2
Jinja2==3.0.3
MarkupSafe==2.0.1
mccabe==0.7.0
mock==5.2.0
netaddr==0.10.1
nose==1.3.7
packaging==21.3
parso==0.7.1
pbr==6.1.1
pexpect==4.9.0
pickleshare==0.7.5
pluggy==1.0.0
prompt-toolkit==3.0.36
ptyprocess==0.7.0
py==1.11.0
pyaml==23.5.8
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
PyYAML==6.0.1
six==1.17.0
tomli==1.2.3
traitlets==4.3.3
typing_extensions==4.1.1
wcwidth==0.2.13
zipp==3.6.0

name: charms.reactive
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
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - 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=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - backcall==0.2.0
      - charmhelpers==1.2.1
      - coverage==6.2
      - decorator==5.1.1
      - flake8==5.0.4
      - importlib-metadata==4.2.0
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - ipdb==0.13.13
      - ipython==7.16.3
      - ipython-genutils==0.2.0
      - jedi==0.17.2
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - mock==5.2.0
      - netaddr==0.10.1
      - nose==1.3.7
      - packaging==21.3
      - parso==0.7.1
      - pbr==6.1.1
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pluggy==1.0.0
      - prompt-toolkit==3.0.36
      - ptyprocess==0.7.0
      - py==1.11.0
      - pyaml==23.5.8
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pyyaml==6.0.1
      - six==1.17.0
      - tomli==1.2.3
      - traitlets==4.3.3
      - typing-extensions==4.1.1
      - wcwidth==0.2.13
      - zipp==3.6.0
prefix: /opt/conda/envs/charms.reactive

tests/test_decorators.py::TestReactiveDecorators::test_not_unless
tests/test_decorators.py::TestReactiveDecorators::test_hook tests/test_decorators.py::TestReactiveDecorators::test_multi tests/test_decorators.py::TestReactiveDecorators::test_only_once tests/test_decorators.py::TestReactiveDecorators::test_when tests/test_decorators.py::TestReactiveDecorators::test_when_all tests/test_decorators.py::TestReactiveDecorators::test_when_any tests/test_decorators.py::TestReactiveDecorators::test_when_file_changed tests/test_decorators.py::TestReactiveDecorators::test_when_none tests/test_decorators.py::TestReactiveDecorators::test_when_not tests/test_decorators.py::TestReactiveDecorators::test_when_not_all
charms/reactive/bus.py charms/reactive/decorators.py
charms/reactive/bus.py charms/reactive/decorators.py