Skip to content

Native: write the engine log to the per-user log directory, never the working directory - #70

Merged
tae898 merged 2 commits into
native-two-distfrom
native-log-dir
Oct 25, 2026
Merged

tae898 merged 2 commits into
native-two-distfrom
native-log-dir

Conversation

@tae898

@tae898 tae898 commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #66 (base native-two-dist). Draft, not for merge before #66.

Problem

The native build writes ./log/arcadedb.log into the current working directory, because the engine's bundled arcadedb-log.properties hard-codes that pattern and nothing in the native loader overrides it. Stray arcadedb.log.* and .lck files appear wherever the process starts (the repository root after a test run). The JVM build already moves the log to a per-user directory (ARCADEDB_LOG_DIR, else the state directory) through two JVM arguments and a rendered logging.properties, and tests/test_log_dir.py has 5 tests that failed on native.

Change

No Java glue and no image rebuild are needed. A native-image isolate takes -D system properties as isolate arguments (the loader already passes -XX: ones from ARCADEDB_NATIVE_ISOLATE_ARGS), and they are in place before any Java code runs, so before the engine's first log call. Checked on an unmodified image: with -Darcadedb.server.logsDirectory=... and -Djava.util.logging.config.file=... as isolate arguments the log goes to the directory and ./log is not created.

  • src/arcadedb/_logdir.py (new, no JPype): the log-directory logic that was in jvm.py (state directory by platform, ARCADEDB_LOG_DIR, temp-dir fallback, rendering of logging.properties), now shared. jvm.py imports it under its old names, so the JVM behaviour and its tests are unchanged.
  • src/arcadedb/_native/lib.py: before graal_create_isolate, create the directory, write logging.properties there and add the two isolate arguments. An argument the user gave in ARCADEDB_NATIVE_ISOLATE_ARGS wins, as jvm_args do on the JVM build. lib.LOG_DIR_USED is the native counterpart of jvm._LOG_DIR_USED.
  • The native image holds the engine's log settings as a resource, but an isolate argument has to name a file and the native wheel ships no jar. _logdir.NATIVE_ENGINE_LOG_PROPERTIES is a copy of that file without its pattern line, and test_native_engine_log_config_matches_the_engine_jar (JVM job, where the jar exists) fails when an engine upgrade changes the file.
  • docs/modules/ROOT/pages/how-to/logs.adoc (new, in the nav): default locations, ARCADEDB_LOG_DIR, and how to set the two properties on each package.

Tests

  • tests/test_log_dir.py: the child script is backend-neutral, so the default-location, ARCADEDB_LOG_DIR and unusable-directory tests now run on both builds (empty read-only working directory, log in the chosen directory, same logging.properties content). The two tests that need a JVM or the engine jar are in NATIVE_NA_JVM_TESTS. New unit tests for the isolate arguments and for the render of the native copy.
  • tests/test_native_log_dir.py (native only): ARCADEDB_NATIVE_ISOLATE_ARGS moves the log, and the user's own logging config file wins; the working directory stays empty in both.

Run on the native image of the tip of #66 (glue unchanged, so no rebuild): test_log_dir 13 passed, 3 skipped as NA-JVM; test_native_log_dir 2 passed; test_core, test_server, test_cypher, test_native_startup_runtime, test_native_xml_limits pass. The JVM-side tests that need no jars pass on the JVM backend, and the engine-jar comparison was checked by hand against arcadedb-engine-26.10.2.jar (equal). The full JVM run of test_log_dir.py needs the JVM wheel and has not been run locally; the JVM job runs it.

🤖 Generated with Claude Code

… working directory

The native library opened ./log/arcadedb.log in the current working directory. The loader now creates the log directory (ARCADEDB_LOG_DIR, else the state directory, like the JVM build), writes logging.properties there and passes arcadedb.server.logsDirectory and java.util.logging.config.file as isolate arguments, which are in place before the engine's first log call. A user's own isolate argument wins. The log-directory logic moves from jvm.py to _logdir.py so both builds share it.

Tests: the subprocess tests of test_log_dir.py run on both builds, test_native_log_dir.py covers the isolate-argument paths, and a JVM-side test compares the native copy of the engine's log settings with the engine jar.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tae898
tae898 marked this pull request as ready for review October 25, 2026 12:26
…name, parity setuptools) into native-log-dir

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tae898
tae898 merged commit 1f5245a into native-two-dist Oct 25, 2026
22 of 23 checks passed
@tae898
tae898 deleted the native-log-dir branch October 25, 2026 13:45
tae898 added a commit that referenced this pull request Oct 25, 2026
…) into native-ci-python-versions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tae898 added a commit that referenced this pull request Oct 25, 2026
…umnar-port

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant