Newbie with first automation

I am trying to write my first 2 automations - first to turn a light on and then to turn it off, both at specified times. I will use a Shelly switch for that. However, just to get started all I want to do is to generate a log message in each automation. I think that I have setup the logger properly in the configuration.yaml using the file-editor add-on. I have created the first automation with specific time as a trigger. Where can I find doc on adding the log message to my automation? Some simple sample automations with logging would be great.
Here is my current automation yaml:
alias: GH seedling lights on
description: Turn on GH grow lights
triggers:

  • trigger: time
    at: “07:00:00”
    conditions:
    actions:
  • action: logger.set_level
    metadata: {}
    data:
    level: debug
    mode: single
    TIA!

What you need is the Syslog integration.

Add this to configuration.yaml then restart Home Assistant.

notify:
  - name: loginfo
    platform: syslog

Then you can use the notify.loginfo action in your automation.

action: notify.loginfo
data:
  title: "This is the title"
  message: "This is the message."

Will this route the log message to syslog? Is that better/more useful than the HA log viewer?

I executed the automation and got 4 lines in the log viewer. Initialized trigger, running automation actions and 2 executing step call. But my message isn’t there.

Yes.

It depends on your intended application.

If you want your message to appear in the Logbook (which is different from Logs), use the logbook.log action.

All I want to do at the moment is to display a message in the log viewer. However, I get the following error message that I don’t understand.
Error: value must be one of [‘CRITICAL’, ‘DEBUG’, ‘ERROR’, ‘FATAL’, ‘INFO’, ‘NOTSET’, ‘WARN’, ‘WARNING’] for dictionary value @ data[‘title’]
Result:

params:
domain: logger
service: set_level
service_data:
level: DEBUG
title: Message Title
message: GH seedling lights on
target: {}
running_script: false

To me this states that my ‘title’ must have the same values as the level, which doesn’t make sense. I obviously misunderstand what is needed. Would someone please explain what this means and how to correct it?

If you’re having difficulties with writing to syslog (a.k.a. “Logs”), I suggest you consider writing to the Logbook (using the logbook.log action). For example, this worked for me.

action: logbook.log
data:
  name: Test
  message: This is a test

On the other hand, if you absolutely want to write to syslog, I will need to see the action you used (in properly formatted YAML).


NOTE

Be advised that the Logs view defaults to displaying INFO level messages and higher.

According to Log Levels, DEBUG is lower than INFO so messages tagged with DEBUG won’t be displayed in the Logs view (they exist in syslog but Logs view doesn’t display them).

To show them you would need to re-configure Logger.