~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_query/logging_query.cc

  • Committer: Andrew Hutchings
  • Date: 2011-01-10 16:11:45 UTC
  • mto: (2069.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2070.
  • Revision ID: andrew@linuxjedi.co.uk-20110110161145-isdc0ncbo2hx2n5c
Fix pandora error message

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
 
20
#include "config.h"
21
21
#include <drizzled/plugin/logging.h>
22
22
#include <drizzled/gettext.h>
23
23
#include <drizzled/session.h>
171
171
    fd= open(_filename.c_str(),
172
172
             O_WRONLY | O_APPEND | O_CREAT,
173
173
             S_IRUSR|S_IWUSR);
174
 
 
175
174
    if (fd < 0)
176
175
    {
177
 
      sql_perror( _("fail open()"), _filename);
 
176
      char errmsg[STRERROR_MAX];
 
177
      strerror_r(errno, errmsg, sizeof(errmsg));
 
178
      errmsg_printf(ERRMSG_LVL_ERROR, _("fail open() fn=%s er=%s\n"),
 
179
                    _filename.c_str(),
 
180
                    errmsg);
178
181
      return;
179
182
    }
180
183
 
268
271
              % session->getQueryId()
269
272
              % dbs
270
273
              % qs
271
 
              % getCommandName(session->command)
 
274
              % command_name[session->command].str
272
275
              % (t_mark - session->getConnectMicroseconds())
273
276
              % session->getElapsedTime()
274
277
              % (t_mark - session->utime_after_lock)
277
280
              % session->tmp_table
278
281
              % session->total_warn_count
279
282
              % session->getServerId()
280
 
              % getServerHostname();
 
283
              % glob_hostname;
281
284
 
282
285
    string msgbuf= formatter.str();
283
286
 
313
316
{
314
317
  context("enable",
315
318
          po::value<bool>(&sysvar_logging_query_enable)->default_value(false)->zero_tokens(),
316
 
          _("Enable logging to CSV file"));
 
319
          N_("Enable logging to CSV file"));
317
320
  context("filename",
318
321
          po::value<string>(),
319
 
          _("File to log to"));
 
322
          N_("File to log to"));
320
323
  context("pcre",
321
324
          po::value<string>()->default_value(""),
322
 
          _("PCRE to match the query against"));
 
325
          N_("PCRE to match the query against"));
323
326
  context("threshold-slow",
324
327
          po::value<uint32_constraint>(&sysvar_logging_query_threshold_slow)->default_value(0),
325
 
          _("Threshold for logging slow queries, in microseconds"));
 
328
          N_("Threshold for logging slow queries, in microseconds"));
326
329
  context("threshold-big-resultset",
327
330
          po::value<uint32_constraint>(&sysvar_logging_query_threshold_big_resultset)->default_value(0),
328
 
          _("Threshold for logging big queries, for rows returned"));
 
331
          N_("Threshold for logging big queries, for rows returned"));
329
332
  context("threshold-big-examined",
330
333
          po::value<uint32_constraint>(&sysvar_logging_query_threshold_big_examined)->default_value(0),
331
 
          _("Threshold for logging big queries, for rows examined"));
 
334
          N_("Threshold for logging big queries, for rows examined"));
332
335
}
333
336
 
334
337
} /* namespace drizzle_plugin */