# No handlers could be found for logger "curator.actions.snapshot"

**URL:** <https://discuss.elastic.co/t/no-handlers-could-be-found-for-logger-curator-actions-snapshot/206947>\
**Category:** Elasticsearch\
**Tags:** curator\
**Created:** [November 7, 2019, 10:26am UTC](https://discuss.elastic.co/t/no-handlers-could-be-found-for-logger-curator-actions-snapshot/206947 "2019-11-07T10:26:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharu85](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tharu85](https://discuss.elastic.co/u/tharu85)\
**Post date:** [November 7, 2019, 10:26am UTC](https://discuss.elastic.co/t/no-handlers-could-be-found-for-logger-curator-actions-snapshot/206947/1 "2019-11-07T10:26:21Z")

</div>

Hi

I am getting following error while I run a python script and the script failed to create the snapshot. How can I fix this

```
No handlers could be found for logger "curator.actions.snapshot"

```

NOTE: The python script use elasticsearch & curator libraries

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [November 7, 2019, 3:33pm UTC](https://discuss.elastic.co/t/no-handlers-could-be-found-for-logger-curator-actions-snapshot/206947/2 "2019-11-07T15:33:23Z")

</div>

This is a message telling you that Curator attempted to initiate logging, but could not find a logging handler. This does not mean that the script failed, but does indicate that you can't see what logs Curator would otherwise be showing you.

---

<div class="post-metadata">

**Author:** ![tharu85](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tharu85](https://discuss.elastic.co/u/tharu85)\
**Post date:** [November 8, 2019, 2:33am UTC](https://discuss.elastic.co/t/no-handlers-could-be-found-for-logger-curator-actions-snapshot/206947/3 "2019-11-08T02:33:17Z")

</div>

So How can I fix this. I used basic logging in my script and tried it.

But still I am getting same error !

![image](https://us1.discourse-cdn.com/elastic/original/3X/9/5/95d1afbc26f5f527fc6e4c5bc5b3f9017cb4b3b7.png)

following are my scripts

(1). EventLogger class

```
import logging

class EventLogger:

    def __init__ (self):
        self.formatter = None
        self.logger = None
        self.file_handler = None
        self.logger_name = None

    def log_event(self):
        self.logger = logging.getLogger( __name__ )
        self.logger.setLevel(logging.DEBUG)
        self.file_handler = logging.FileHandler('snap.log')
        self.file_handler.setLevel(logging.DEBUG)
        self.formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        self.file_handler.setFormatter(self.formatter)
        self.logger.addHandler(self.file_handler)
        return self.logger

```

(2). Creating snapshot

```
from elasticsearch import Elasticsearch
import curator
import eventlogger

el = eventlogger.EventLogger()
elg = el.log_event()

indices_list = [2000]

for indice in indices_list:
   REPOSITORY = 'index_backup'
   SOURCE = 'creation_date'
   DIRECTION = 'older'
   UNIT = 'days'
   UNIT_COUNT = 10
   INDEX_NAME = 'xxxxxxx_' + str(indice)

   es = Elasticsearch(['http://xxx.xxx.xxx.1', 'http://xxx.xxx.xxx.2'], port=9200, timeout=3600)

   try:
      ilo = curator.IndexList(es)
      ilo.filter_by_age(source=SOURCE, direction=DIRECTION, unit=UNIT, unit_count=UNIT_COUNT)
      ilo.filter_by_regex(kind='prefix', value=INDEX_NAME)
      snap_indicies = curator.Snapshot(ilo, REPOSITORY, INDEX_NAME, skip_repo_fs_check=True)
      snap_indicies.do_action()

      get_snapshot_state = snap_indicies.get_state()
      if get_snapshot_state == 'SUCCESS':
           elg.info('Successfully Created the Snapshot')
      else:
           elg.error('Failed to Create the Snapshot')
    except Exception as snapindicies:
      elg.error('Exception Occured Creating the Snapshot')
```

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [November 13, 2019, 1:40pm UTC](https://discuss.elastic.co/t/no-handlers-could-be-found-for-logger-curator-actions-snapshot/206947/4 "2019-11-13T13:40:51Z")

</div>

You've made your _own_ logging event class, but not set up any _local_ logging. Everything inside that `elg` is stuck in `elg` and will only log when you call something in `elg`. Curator won't know what to do with that.

Perhaps if you put the `log_event` method calls inside your primary script and declared a regular python logger, not your class, it would work:

```auto
from elasticsearch import Elasticsearch
import curator
import logging

logger = logging.getLogger('my_script')
logger.setLevel(logging.DEBUG)
file_handler = logging.FileHandler('snap.log')
file_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler.setFormatter(self.formatter)
logger.addHandler(self.file_handler)

indices_list = [2000]

for indice in indices_list:
   REPOSITORY = 'index_backup'
…
        if get_snapshot_state == 'SUCCESS':
            logger.info('Successfully Created the Snapshot')
…

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 11, 2019, 1:40pm UTC](https://discuss.elastic.co/t/no-handlers-could-be-found-for-logger-curator-actions-snapshot/206947/5 "2019-12-11T13:40:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
