Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7432675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:29:43+00:00 2026-05-29T09:29:43+00:00

I am facing a strange behavior by CakePHP 2.1: I have a method, $this->Time->getTime();

  • 0

I am facing a strange behavior by CakePHP 2.1:

I have a method, $this->Time->getTime(); which always logs an action, then returns true. When called from the browser, it works as expected: logs the action, then returns true.

I created a shell, TimeShell, in which I log another action only if $this->Time->getTime(); returns true. Now, the weird thing is that the second action is logged, hence the method returned true, but the action from the method (which obviously had to run since it passed it and returned true) isn’t logged.

Why isn’t the first action logged when the method is called from the shell? (if it helps, the shell is run via a cron job on my server)

EDIT

After further testing, I found out that if I don’t log the second action (the one in the shell), then the first action (in $this->Time->getTime();) is correctly logged. But I can’t figure out why does Cake only log the last action from those which should be logged.

Moreover, it seems that only the DatabaseLogger behaves this way, FileLog logs both actions. Very weird.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:29:44+00:00Added an answer on May 29, 2026 at 9:29 am

    Looks like the answer was extremely simple: I forgot to call $this->Log->create(); before saving the logged action, hence the second action was overwriting the first one.

    This being said, I recommend checking that you have the create(); method called if you encounter any problem with saving data (mostly when overwriting occurs). In many cases, this would be the solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

facing some strange behavior in OSB, i have configured WLS with MQ in client
Its very strange behavior that I'm facing. I have delete button, OnClick I'm attaching
I am facing a strange problem regarding Hooking. I have a procedure which acts
I am facing a very strange issue. I have a SharePoint webpart that displays
I'm facing kind of a strange issue which is related MD5-Hashes in Java and
I'm facing strange error. I use Glassfish 3.1.1 withn jdk7 and since some time
I am facing strange problem. I am compiling a MFC application(VS 2008) which uses
I am facing a strange error in cakephp2.0. I have created two layouts -
I am facing some strange behavior with file-name completion in emacs. C-x C-f to
I am facing a strange issue of different behavior of a same web application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.