# Elasticsearch createTranslogSyncProcessor part of source code, log level Setting is not appropriate?

**URL:** <https://discuss.elastic.co/t/elasticsearch-createtranslogsyncprocessor-part-of-source-code-log-level-setting-is-not-appropriate/332539>\
**Category:** Elasticsearch\
**Created:** [May 4, 2023, 10:54am UTC](https://discuss.elastic.co/t/elasticsearch-createtranslogsyncprocessor-part-of-source-code-log-level-setting-is-not-appropriate/332539 "2023-05-04T10:54:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yujie\_wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yujie_wang/32/120620_2.png) [@yujie\_wang](https://discuss.elastic.co/u/yujie_wang)\
**Post date:** [May 4, 2023, 10:54am UTC](https://discuss.elastic.co/t/elasticsearch-createtranslogsyncprocessor-part-of-source-code-log-level-setting-is-not-appropriate/332539/1 "2023-05-04T10:54:48Z")

</div>

Hi,  
Recently, I've been reading the source code of the latest version (8.7.1) of Elasticsearch and I have a question about the log level settings that I can't figure out.  
I noticed that the "failed to sync translog" issue in maybeFSyncTranslogs in Elasticsearch/index/IndexService.java is logged as a warning level:

```auto
private void maybeFSyncTranslogs() {
        if (indexSettings.getTranslogDurability() == Translog.Durability.ASYNC) {
            for (IndexShard shard : this.shards.values()) {
                try {
                    if (shard.isSyncNeeded()) {
                        shard.sync();
                    }
                } catch (AlreadyClosedException ex) {
                    // fine - continue;
                } catch (IOException e) {
                    logger.warn("failed to sync translog", e);
                }
            }
        }
    }

```

but in Elasticsearch/index/shard/IndexShard.java, the same issue in createTranslogSyncProcessor is logged as a debug level：

```auto
private static AsyncIOProcessor<Translog.Location> createTranslogSyncProcessor(
        Logger logger,
        ThreadContext threadContext,
        Supplier<Engine> engineSupplier
    ) {
        return new AsyncIOProcessor<>(logger, 1024, threadContext) {
            @Override
            protected void write(List<Tuple<Translog.Location, Consumer<Exception>>> candidates) throws IOException {
                try {
                    engineSupplier.get().ensureTranslogSynced(candidates.stream().map(Tuple::v1));
                } catch (AlreadyClosedException ex) {
                    // that's fine since we already synced everything on engine close - this also is conform with the methods
                    // documentation
                } catch (IOException ex) { // if this fails we are in deep shit - fail the request
                    logger.debug("failed to sync translog", ex);
                    throw ex;
                }
            }
        };
    }

```

After reading the context and comments of the latter, I'm wondering if the debug level in the latter should also be changed to a warn level? Or does the use of debug have a different explanation here?  
thanks

---

<div class="post-metadata">

**Author:** ![yujie\_wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yujie_wang/32/120620_2.png) [@yujie\_wang](https://discuss.elastic.co/u/yujie_wang)\
**Post date:** [May 17, 2023, 3:21am UTC](https://discuss.elastic.co/t/elasticsearch-createtranslogsyncprocessor-part-of-source-code-log-level-setting-is-not-appropriate/332539/2 "2023-05-17T03:21:16Z")

</div>

Does anyone have a comment?

---

<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:** [June 14, 2023, 3:21am UTC](https://discuss.elastic.co/t/elasticsearch-createtranslogsyncprocessor-part-of-source-code-log-level-setting-is-not-appropriate/332539/3 "2023-06-14T03:21:45Z")

</div>

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