Skip to content

File cas_log.c

FileList > broker > cas_log.c

Go to the source code of this file

  • #include <stdio.h>
  • #include <stdarg.h>
  • #include <stdlib.h>
  • #include <time.h>
  • #include <string.h>
  • #include <errno.h>
  • #include <unistd.h>
  • #include <sys/time.h>
  • #include <assert.h>
  • #include "porting.h"
  • #include "cas_common.h"
  • #include "cas_log.h"
  • #include "broker_config.h"
  • #include "broker_filename.h"
  • #include "broker_util.h"
  • #include "dbi.h"
  • #include "hide_password.h"
  • #include "cas_optimization.h"
  • #include "cas_common_vars.h"

Public Static Attributes

Type Name
char cas_log_buffer
CAS_LOG_FD_STATUS cas_log_fd_status = CAS\_LOG\_FD\_NONE
char log_filepath
FILE * log_fp = [**NULL**](freelistheap_8h.md#define-null)
INT64 saved_log_fpos = 0
INT64 saved_temp_stmt_fpos = 0
char slow_log_filepath
FILE * slow_log_fp = [**NULL**](freelistheap_8h.md#define-null)
char sql_log_buffer

Public Functions

Type Name
int cas_access_log (struct timeval * start_time, int as_index, int client_ip_addr, char * dbname, char * dbuser, ACCESS_LOG_TYPE log_type)
void cas_log_close (bool flag)
void cas_log_compile_begin_write_query_string (char * query, int size, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
void cas_log_compile_begin_write_query_string_nonl (char * query, int size, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
void cas_log_compile_end_write_query_string (char * query, int size, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
void cas_log_compile_end_write_query_string_nonl (char * query, int size, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
void cas_log_debug (const char * file_name, const int line_no, const char * fmt, ...)
void cas_log_end (int mode, int run_time_sec, int run_time_msec)
CAS_LOG_FD_STATUS cas_log_get_fd_status (void)
void cas_log_open (char * br_name)
void cas_log_open_and_write (char * br_name, unsigned int seq_num, bool unit_start, const char * fmt, ...)
void cas_log_query_info_init (int id, char is_only_query_plan)
char * cas_log_query_plan_file (int id)
void cas_log_reset (char * br_name)
void cas_log_write (unsigned int seq_num, bool unit_start, const char * fmt, ...)
void cas_log_write2 (const char * fmt, ...)
void cas_log_write2_nonl (const char * fmt, ...)
void cas_log_write_and_end (unsigned int seq_num, bool unit_start, const char * fmt, ...)
void cas_log_write_client_ip (const unsigned char * ip_addr)
void cas_log_write_nonl (unsigned int seq_num, bool unit_start, const char * fmt, ...)
void cas_log_write_query_string (char * query, int size, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
void cas_log_write_query_string_nonl (char * query, int size, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
void cas_log_write_value_string (char * value, int size)
void cas_slow_log_close ()
void cas_slow_log_end ()
void cas_slow_log_open (char * br_name)
void cas_slow_log_reset (char * br_name)
void cas_slow_log_write (struct timeval * log_time, unsigned int seq_num, bool unit_start, const char * fmt, ...)
void cas_slow_log_write2 (const char * fmt, ...)
void cas_slow_log_write_and_end (struct timeval * log_time, unsigned int seq_num, const char * fmt, ...)
void cas_slow_log_write_query_string (char * query, int size, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
void cas_slow_log_write_value_string (char * value, int size)

Public Static Functions

Type Name
void access_log_backup (char * access_log_file, struct tm * ct)
FILE * access_log_open (char * log_file_name)
int cas_fclose (FILE * fp)
int cas_fflush (FILE * stream)
int cas_fileno (FILE * stream)
FILE * cas_fopen (const char * path, const char * mode)
int cas_fprintf (FILE * stream, const char * format, ...)
void cas_fprintf_password (FILE * fp, char * query, HIDE_PWD_INFO_PTR hide_pwd_info_ptr)
int cas_fputc (int c, FILE * stream)
int cas_fseek (FILE * stream, INT64 offset, int whence)
INT64 cas_ftell (FILE * stream)
int cas_ftruncate (int fd, off_t length)
size_t cas_fwrite (const void * ptr, size_t size, size_t nmemb, FILE * stream)
void cas_log_backup (T_CUBRID_FILE_ID fid)
void cas_log_query_cancel (int dummy, ...)
void cas_log_rename (int run_time, time_t cur_time, char * br_name, int as_index)
void cas_log_write2_internal (FILE * fp, bool do_flush, const char * fmt, va_list ap)
void cas_log_write_and_set_savedpos (FILE * log_fp, const char * fmt, ...)
void cas_log_write_internal (FILE * fp, struct timeval * log_time, unsigned int seq_num, bool do_flush, const char * fmt, va_list ap)
void cas_log_write_query_string_internal (char * query, int size, bool newline, HIDE_PWD_INFO_PTR hide_pwd_info_ptr, bool ishidepw)
int cas_mkdir (const char * pathname, mode_t mode)
int cas_rename (const char * oldpath, const char * newpath)
int cas_unlink (const char * pathname)
const char * get_access_log_type_string (ACCESS_LOG_TYPE type)
char * make_sql_log_filename (T_CUBRID_FILE_ID fid, char * filename_buf, size_t buf_size, const char * br_name)

Macros

Type Name
define ACCESS_LOG_IS_DENIED_TYPE (T) ((T)==ACL\_REJECTED)
define CAS_LOG_BUFFER_SIZE (8192)
define CAS_LOG_HIDE_PW 1
define CAS_LOG_VISIBLE_PW 0
define SQL_LOG_BUFFER_SIZE 163840

Public Static Attributes Documentation

variable cas_log_buffer

char cas_log_buffer[(8192)];

variable cas_log_fd_status

CAS_LOG_FD_STATUS cas_log_fd_status;

variable log_filepath

char log_filepath[(PATH_MAX)];

variable log_fp

FILE* log_fp;

variable saved_log_fpos

INT64 saved_log_fpos;

variable saved_temp_stmt_fpos

INT64 saved_temp_stmt_fpos;

variable slow_log_filepath

char slow_log_filepath[(PATH_MAX)];

variable slow_log_fp

FILE * slow_log_fp;

variable sql_log_buffer

char sql_log_buffer[163840];

Public Functions Documentation

function cas_access_log

int cas_access_log (
    struct  timeval * start_time,
    int as_index,
    int client_ip_addr,
    char * dbname,
    char * dbuser,
    ACCESS_LOG_TYPE log_type
) 

function cas_log_close

void cas_log_close (
    bool flag
) 

function cas_log_compile_begin_write_query_string

void cas_log_compile_begin_write_query_string (
    char * query,
    int size,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_log_compile_begin_write_query_string_nonl

void cas_log_compile_begin_write_query_string_nonl (
    char * query,
    int size,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_log_compile_end_write_query_string

void cas_log_compile_end_write_query_string (
    char * query,
    int size,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_log_compile_end_write_query_string_nonl

void cas_log_compile_end_write_query_string_nonl (
    char * query,
    int size,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_log_debug

void cas_log_debug (
    const  char * file_name,
    const  int line_no,
    const  char * fmt,
    ...
) 

function cas_log_end

void cas_log_end (
    int mode,
    int run_time_sec,
    int run_time_msec
) 

function cas_log_get_fd_status

CAS_LOG_FD_STATUS cas_log_get_fd_status (
    void
) 

function cas_log_open

void cas_log_open (
    char * br_name
) 

function cas_log_open_and_write

void cas_log_open_and_write (
    char * br_name,
    unsigned  int seq_num,
    bool unit_start,
    const  char * fmt,
    ...
) 

function cas_log_query_info_init

void cas_log_query_info_init (
    int id,
    char is_only_query_plan
) 

function cas_log_query_plan_file

char * cas_log_query_plan_file (
    int id
) 

function cas_log_reset

void cas_log_reset (
    char * br_name
) 

function cas_log_write

void cas_log_write (
    unsigned  int seq_num,
    bool unit_start,
    const  char * fmt,
    ...
) 

function cas_log_write2

void cas_log_write2 (
    const  char * fmt,
    ...
) 

function cas_log_write2_nonl

void cas_log_write2_nonl (
    const  char * fmt,
    ...
) 

function cas_log_write_and_end

void cas_log_write_and_end (
    unsigned  int seq_num,
    bool unit_start,
    const  char * fmt,
    ...
) 

function cas_log_write_client_ip

void cas_log_write_client_ip (
    const  unsigned  char * ip_addr
) 

function cas_log_write_nonl

void cas_log_write_nonl (
    unsigned  int seq_num,
    bool unit_start,
    const  char * fmt,
    ...
) 

function cas_log_write_query_string

void cas_log_write_query_string (
    char * query,
    int size,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_log_write_query_string_nonl

void cas_log_write_query_string_nonl (
    char * query,
    int size,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_log_write_value_string

void cas_log_write_value_string (
    char * value,
    int size
) 

function cas_slow_log_close

void cas_slow_log_close () 

function cas_slow_log_end

void cas_slow_log_end () 

function cas_slow_log_open

void cas_slow_log_open (
    char * br_name
) 

function cas_slow_log_reset

void cas_slow_log_reset (
    char * br_name
) 

function cas_slow_log_write

void cas_slow_log_write (
    struct  timeval * log_time,
    unsigned  int seq_num,
    bool unit_start,
    const  char * fmt,
    ...
) 

function cas_slow_log_write2

void cas_slow_log_write2 (
    const  char * fmt,
    ...
) 

function cas_slow_log_write_and_end

void cas_slow_log_write_and_end (
    struct  timeval * log_time,
    unsigned  int seq_num,
    const  char * fmt,
    ...
) 

function cas_slow_log_write_query_string

void cas_slow_log_write_query_string (
    char * query,
    int size,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_slow_log_write_value_string

void cas_slow_log_write_value_string (
    char * value,
    int size
) 

Public Static Functions Documentation

function access_log_backup

static void access_log_backup (
    char * access_log_file,
    struct  tm * ct
) 

function access_log_open

static FILE * access_log_open (
    char * log_file_name
) 

function cas_fclose

static int cas_fclose (
    FILE * fp
) 

function cas_fflush

static int cas_fflush (
    FILE * stream
) 

function cas_fileno

static int cas_fileno (
    FILE * stream
) 

function cas_fopen

static FILE * cas_fopen (
    const  char * path,
    const  char * mode
) 

function cas_fprintf

static int cas_fprintf (
    FILE * stream,
    const  char * format,
    ...
) 

function cas_fprintf_password

static void cas_fprintf_password (
    FILE * fp,
    char * query,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr
) 

function cas_fputc

static int cas_fputc (
    int c,
    FILE * stream
) 

function cas_fseek

static int cas_fseek (
    FILE * stream,
    INT64 offset,
    int whence
) 

function cas_ftell

static INT64 cas_ftell (
    FILE * stream
) 

function cas_ftruncate

static int cas_ftruncate (
    int fd,
    off_t length
) 

function cas_fwrite

static size_t cas_fwrite (
    const  void * ptr,
    size_t size,
    size_t nmemb,
    FILE * stream
) 

function cas_log_backup

static void cas_log_backup (
    T_CUBRID_FILE_ID fid
) 

function cas_log_query_cancel

static void cas_log_query_cancel (
    int dummy,
    ...
) 

function cas_log_rename

static void cas_log_rename (
    int run_time,
    time_t cur_time,
    char * br_name,
    int as_index
) 

function cas_log_write2_internal

static void cas_log_write2_internal (
    FILE * fp,
    bool do_flush,
    const  char * fmt,
    va_list ap
) 

function cas_log_write_and_set_savedpos

static void cas_log_write_and_set_savedpos (
    FILE * log_fp,
    const  char * fmt,
    ...
) 

function cas_log_write_internal

static void cas_log_write_internal (
    FILE * fp,
    struct  timeval * log_time,
    unsigned  int seq_num,
    bool do_flush,
    const  char * fmt,
    va_list ap
) 

function cas_log_write_query_string_internal

static void cas_log_write_query_string_internal (
    char * query,
    int size,
    bool newline,
    HIDE_PWD_INFO_PTR hide_pwd_info_ptr,
    bool ishidepw
) 

function cas_mkdir

static int cas_mkdir (
    const  char * pathname,
    mode_t mode
) 

function cas_rename

static int cas_rename (
    const  char * oldpath,
    const  char * newpath
) 

static int cas_unlink (
    const  char * pathname
) 

function get_access_log_type_string

static const  char * get_access_log_type_string (
    ACCESS_LOG_TYPE type
) 

function make_sql_log_filename

static char * make_sql_log_filename (
    T_CUBRID_FILE_ID fid,
    char * filename_buf,
    size_t buf_size,
    const  char * br_name
) 

Macro Definition Documentation

define ACCESS_LOG_IS_DENIED_TYPE

#define ACCESS_LOG_IS_DENIED_TYPE (
    T
) `((T)== ACL_REJECTED )`

define CAS_LOG_BUFFER_SIZE

#define CAS_LOG_BUFFER_SIZE `(8192)`

define CAS_LOG_HIDE_PW

#define CAS_LOG_HIDE_PW `1`

define CAS_LOG_VISIBLE_PW

#define CAS_LOG_VISIBLE_PW `0`

define SQL_LOG_BUFFER_SIZE

#define SQL_LOG_BUFFER_SIZE `163840`


The documentation for this class was generated from the following file cubrid/src/broker/cas_log.c