web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Log file data with Dat...
Power Automate
Unanswered

Log file data with Date time stamp on each line

(1) ShareShare
ReportReport
Posted on by 18

Good day,

 

I have to log each decision making or milestone points in a log file for debugging purpose/tracing/log purpose. 

 

Example:

File name: Logfile_1.txt

File content should be like this :

27-05-2023 10:33:44 : My Bot Process Step : 1
27-05-2023 10:37:01 : My Bot Process Step : 2
27-05-2023 10:39:00 : My Bot Process Step : 3
27-05-2023 10:41:20 : My Bot Process Step : 4
27-05-2023 10:46:51 : My Bot Process Step : 5

 

Activity :

Get current date and time : i dont want use this activity again and again to get the date and time. (every time prior write to log file / text file)

Is there a way I can achieve this ? 

 

This is what happening which I dont want: 

PrSelvan_0-1685164041057.png

 

or to use the get current date and time activity every time :

PrSelvan_1-1685164172363.png

 

 

Thanks in advance! 

 

 

 

 

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Run cmd instead. This should be able to append a line to the .txt without ever having to open it. 

    echo %date:~4,10% %time:~0,5% Step 1 Completed >> C:\Documents\Logfile.txt

    in this code, it gets the date and time in a specific format. I believe the 4 gets you the proper regional setting, so hopefully you don’t have to adjust. “Step 1 completed” can be whatever you want, and then it appends it to the logfile on its own line.  Replace the file path with the proper one. 

    this will take you from having two separate actions to just having one, and it should be able to send off the cmd command and then continue to run while cmd writes to the txt file. 

    best of luck!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 997

#2
Valantis Profile Picture

Valantis 810

#3
Haque Profile Picture

Haque 642

Last 30 days Overall leaderboard