<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>flashlog loses pushed string contents</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83064/flashlog-loses-pushed-string-contents</link><description>Hi, 
 I&amp;#39;m using the flashlog on my nRF52840 to log events. I have an external RTC which I read when logging each event in order to timestamp the event. My RTC code writes to a static char array, and I use NRF_LOG_PUSH to save the value when I log the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Jan 2022 09:10:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83064/flashlog-loses-pushed-string-contents" /><item><title>RE: flashlog loses pushed string contents</title><link>https://devzone.nordicsemi.com/thread/347705?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 09:10:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69c8af1f-fff8-489a-afaa-e9b32ff81dc3</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Brian,&amp;nbsp;&lt;br /&gt;Thanks for the info. I think we have an idea of what could be wrong here. &lt;br /&gt;Since you declared the p_dt as static string, the logger module would assume it&amp;#39;s a static text, just like the other text &amp;quot;Entering state idle2&amp;quot; and use a reference to it like what Vidar explained. But the problem is that it&amp;#39;s stored in RAM not flash. So when you have a power reset, the static string is gone and you don&amp;#39;t see it anymore.&amp;nbsp;&lt;br /&gt;But when you store them as integer ( I would assume without static ) it&amp;#39;s treated as variable and will be stored as a new entry in flash log every time you push.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: flashlog loses pushed string contents</title><link>https://devzone.nordicsemi.com/thread/347669?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 00:17:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f2f5b46-5138-4bff-a67d-4682248b3877</guid><dc:creator>Brian</dc:creator><description>&lt;p&gt;I was able to resolve this by storing my RTC data as multiple separate integer values rather than just one string.&amp;nbsp; I believe this allows each value to be stored in the flashlog rather than a pointer to a single location.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: flashlog loses pushed string contents</title><link>https://devzone.nordicsemi.com/thread/347651?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 16:53:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa560769-1042-4491-923b-bd24c67b59c7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hei Brian,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry for late response. Jared is on vacation so I will take over the case.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;If you have a look at this case handled by Vidar :&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/58111/implement-flashlog-backend"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/58111/implement-flashlog-backend&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;He explained a little bit more about how flashlog is stored and on that the variable is stored at a different location compare to the static log (e.g &amp;quot;Entering state idle2&amp;quot;) . It may explain why you only see the static one not the date and time.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: flashlog loses pushed string contents</title><link>https://devzone.nordicsemi.com/thread/345499?ContentTypeID=1</link><pubDate>Thu, 30 Dec 2021 15:46:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61ffd97f-961f-481d-ba0a-471c6dc3b522</guid><dc:creator>Brian</dc:creator><description>&lt;p&gt;Hi Jared,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; I&amp;#39;m using SDK 17.0.2.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; After a power cycle, p_dt contains the address of the variable dt_str (0x2000 d548).&amp;nbsp; dt_str is the statically-declared variable that gets updated by the logging_datetime_get() function -&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1640878809359v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define DATE_TIME_STR_SIZE 32

static char          dt_str[DATE_TIME_STR_SIZE];
static char*         month_str[NUM_MONTHS + 1]  = {&amp;quot;Inv&amp;quot;, &amp;quot;Jan&amp;quot;, &amp;quot;Feb&amp;quot;, &amp;quot;Mar&amp;quot;, &amp;quot;Apr&amp;quot;, &amp;quot;May&amp;quot;, &amp;quot;Jun&amp;quot;,
                                          &amp;quot;Jul&amp;quot;, &amp;quot;Aug&amp;quot;, &amp;quot;Sep&amp;quot;, &amp;quot;Oct&amp;quot;, &amp;quot;Nov&amp;quot;, &amp;quot;Dec&amp;quot;};

char* logging_datetime_get(void)
{
    error_status_t err;
    date_time_t    date_time;

    err = pcf8563_datetime_get(rtc_handle, &amp;amp;date_time);

    if (err == ERROR_OK)
    {
        (void)snprintf(dt_str, DATE_TIME_STR_SIZE, &amp;quot;(20%02d-%s-%02d: %02d:%02d:%02d)&amp;quot;, date_time.year,
                       month_str[date_time.month], date_time.day, date_time.hour, date_time.minute, date_time.second);
    }

    return dt_str;
}
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; I understand that after a power cycle, p_dt will not point to the correct timestamp data for previous entries in the flashlog.&amp;nbsp; My assumption was that using NRF_LOG_PUSH would save the contents of the string, which in this case would be the timestamp when the event was first logged.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Thanks.&lt;/p&gt;
&lt;p&gt;Brian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: flashlog loses pushed string contents</title><link>https://devzone.nordicsemi.com/thread/344940?ContentTypeID=1</link><pubDate>Thu, 23 Dec 2021 12:19:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a9260b5-c790-4039-84c0-c78efe506361</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What SDK version are you using?&lt;/p&gt;
&lt;p&gt;After the power cycle, could you pause the application after logging_datetime_get() with a debugger and see what p_dt is set to in debug view?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, we&amp;#39;re short on staff due to the Holiday season. Expect some delay in the handling of this case.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>