Commit Graph
13 Commits
Author SHA1 Message Date
e35171c3f9 fix(logger): make logger off close the active log file (#28636)
* fix(logger): make off stop active file logging

Handle logger on and off as explicit requests so logger off closes an active file log without disabling future automatic activations. Continuous logging modes fall back to arm-to-disarm sessions until reboot after their active log is stopped.

Assisted-by: Codex:gpt-5
Signed-off-by: jc-works <jc-works@users.noreply.github.com>

* fix(logger): keep the configured log mode on manual stop

Falling back to LogMode::while_armed by overwriting _log_mode destroyed the
configured mode for the rest of the boot, and nothing reported it: neither
logger status nor LoggerStatus carries the mode.

Only boot_until_shutdown needs the fallback at all, because its early return
would otherwise keep logging disabled once the boot log is stopped. Express
that with a dedicated flag so _log_mode stays the configured value, and say so
on the console when it happens.

arm_until_shutdown needs no fallback. After the forced stop
_prev_file_log_start_state is false, so full_log_continues is false and the
desired state falls back to plain arming. The next arming starts a log and sets
the flag again, so the following disarm keeps logging to shutdown as configured
instead of ending the log early.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Julian Oes <julian@oes.ch>

* fix(logger): restore SDLOG_MODE 2 logging behaviour after rearming

After logger off stops a boot-to-shutdown log, suspend automatic logging only until the next arming. Restore the configured lifecycle when the new log starts so it continues across subsequent disarms until shutdown.

Update the logger message and documentation accordingly.

Assisted-by: Codex:gpt-5
Signed-off-by: jc-works <jc-works@users.noreply.github.com>

* fix(logger): make repeated off requests idempotent

Regression testing found that repeating logger off after the active log had closed cleared the manual stop latch. When the arming or AUX logging condition remained active, automatic logging started a new log.

Preserve the manual stop latch across repeated off requests so logging remains stopped until the automatic logging condition deactivates. The latch is also cleared explicitly by logger on.

Assisted-by: Codex:gpt-5
Signed-off-by: jc-works <jc-works@users.noreply.github.com>

---------

Signed-off-by: jc-works <jc-works@users.noreply.github.com>
Signed-off-by: Julian Oes <julian@oes.ch>
Co-authored-by: jc-works <jc-works@users.noreply.github.com>
Co-authored-by: Julian Oes <julian@oes.ch>
2026-09-27 14:27:50 +13:00
Julian Oes cc976e150a feat(posix): separate the filesystem root from the storage directory (#28582)
On NuttX these are two things: / is the filesystem root, and /fs/microsd is the
SD card mounted under it. MAVLink FTP serves the root and confines writes to the
SD card, so the read-only ROMFS at /etc is visible but cannot be written.

On POSIX they were the same directory. PX4_ROOTFSDIR and PX4_STORAGEDIR both
resolved to CONFIG_BOARD_ROOT_PATH, which on SITL is ".", so the working
directory was simultaneously the FTP root and the only writable area. The
consequences were that the ROMFS symlink sat inside the FTP root, and that
_validatePathIsWritable() had nothing meaningful to check against and so was
compiled out on POSIX entirely, leaving no write restriction at all.

Give POSIX the same split. CONFIG_BOARD_ROOT_PATH keeps its meaning as the
storage directory, and a new CONFIG_BOARD_FS_ROOT_PATH names the root FTP
serves, defaulting to the storage path so every existing board is unchanged.
SITL sets the root to "." and storage to "./fs", which mirrors NuttX: logs,
parameters, dataman and eeprom move under ./fs, and etc/ stays in the root as
read-only data.

With storage distinct from the root, the write restriction now applies on every
platform rather than NuttX only, and no longer compares against a hardcoded
prefix length that was wrong for any board not using /fs/microsd.

Assisted-by: Claude:claude-opus-5[1m]

Signed-off-by: Julian Oes <julian@oes.ch>
2026-09-08 17:01:55 -06:00
Hamish Willee d5e5143090 docs(update): Logger max file size from 2 to 4 GB (#28058) 2026-07-22 20:39:17 -06:00
PX4BuildBot ff80586b5d docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-05-29 03:00:39 +00:00
9ae1e0f04f feat(logger): append topics defined in logger_topics.txt instead of replacing all (#27462)
* feat(logger): append topics defined in logger_topics.txt instead of replacing logging profile

* docs(logger): Explain how logger_topics.txt topics are being used

* refactor(logger): squash initialize functions into a single one

* docs(docs): Subedit

---------

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
2026-05-28 20:53:31 -06:00
PX4BuildBot c89404ca61 docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-04-22 22:38:10 +00:00
Julian Oes f9fdda1a29 feat(logger): rework log rotation and cleanup
Make the logger practical on small flash storage (e.g. 128 MB W25N
NAND) while keeping the existing SD-card behaviour sensible.

- Move cleanup from boot to log start so logs can be downloaded via
  MAVLink FTP before deletion.
- Delete individual .ulg files (oldest first) instead of whole
  directories, prioritising the naming scheme not currently in use
  (session dirs vs date dirs).
- Add SDLOG_MAX_SIZE (new, default 1024 MB): maximum size of a single
  log file. When reached, the log rotates to a new file. The value is
  also reserved as headroom in the cleanup threshold.
- Add SDLOG_ROTATE (new, default 90): maximum disk usage percentage.
  Cleanup guarantees (100 - SDLOG_ROTATE)% free at all times, even
  during writing of a new log file. 0 disables space-based cleanup,
  100 allows filling the disk.
- Repurpose SDLOG_DIRS_MAX as an orthogonal directory-count cap
  (default 0 = disabled). Useful for capping log usage by count
  independent of disk size, e.g. in SITL.
- Drop the implicit ~300 MB free-space floor that used to fire even
  with SDLOG_DIRS_MAX=0; space is now governed entirely by
  SDLOG_ROTATE + SDLOG_MAX_SIZE.
- Split pure parsing helpers into util_parse.{h,cpp} and add unit
  tests (loggerUtilTest.cpp).
- Simplify get_log_time to rely on clock_gettime (set by the GPS
  driver); safer string handling in directory parsing.
- Reset _total_written in LogFileBuffer::reset() so callers reading
  get_total_written() between stop and start don't see stale counts.

Sponsored by CubePilot.
2026-04-23 10:30:14 +12:00
PX4BuildBot 36b5e1e1bb docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-02-11 22:43:01 +00:00
12035682d7 Use MAVLink v1 only as opt-in (#25583)
* Remove support for MAVLink 1

* Add back support for MAVLink 1 but don't default to it

* Update src/modules/mavlink/mavlink_params.c

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

---------

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
2025-10-13 20:58:34 -08:00
Alexander Lerach 8f2c36689d logging: allow logging backend config
* logging: allow logging backend config

* correct board comments

* documentation: updated logging section
2025-08-27 15:44:36 +02:00
Hamish Willee 2c31e2bad5 Fix all possible HTTP to HTTPS docs links (#25153) 2025-07-03 18:09:58 +10:00
Matthias Grob 2bc04f91f8 docs: fix all end of file newlines
Note: Some files are autogenerated and I did not yet
go through each source of generation to fix it there.
Instead I adjusted the filter to only exclude those
such that we can fix things in steps.
2025-06-26 11:03:23 -07:00
Hamish WilleeandRamon Roche 88d623bedb Move PX4 Guide source into /docs (#24490)
* Add vitepress tree

* Update existing workflows so they dont trigger on changes in the docs path

* Add nojekyll, package.json, LICENCE etc

* Add crowdin docs upload/download scripts

* Add docs flaw checker workflows

* Used docs prefix for docs workflows

* Crowdin obvious fixes

* ci: docs move to self hosted runner

runs on a beefy server for faster builds

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* ci: don't run build action for docs or ci changes

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* ci: update runners

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* Add docs/en

* Add docs assets and scripts

* Fix up editlinks to point to PX4 sources

* Download just the translations that are supported

* Add translation sources for zh, uk, ko

* Update latest tranlsation and uorb graphs

* update vitepress to latest

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Co-authored-by: Ramon Roche <mrpollo@gmail.com>
2025-03-13 16:08:27 +11:00