4. Logging Smarty¶
4.1. Logs Smarty¶
Entries in the logs are as follows:
%(timestamp)% %(log level)% %(module)%:%(code line number)% %(function)%[%(pid)%.%(thread id)%] %(message text)%
The message (message text) consists of the name of events and additional context.
An example entry in the log:
Fri Mar 24 10:22:35+0300 2017 DEBUG api:621 get[83630.Thread-3] SOME_EVENT 'ip'='127.0.0.1' args=['foo', 'bar']
In this example:
- Fri
- day of the week
- Mar
- a month
- 24
- date
- 10:22:35
- local time in timezone specified in settings.py in the constant TIME_ZONE
- +0300
- the offset relative to UTC
- 2017
- year
- DEBUG
- the level of logging
- api:621
- the file name and line number
- get[83630.Thread-3]
- the name of the function, the pid and the name of the thread
- SOME_EVENT
- event name
- ip and args
- additional context
The level of logging westvlaamse in the project settings(smarty/settings/settings_<local>.py). For example, to set the INFO level to log api requests, you must add the following code:
LOGGING['handlers']['smarty_api_requests_handler']['level'] = "INFO"
Events depending on type are grouped in different files. By default, logs are stored at the address /var/log/microimpuls/smarty/
.
4.1.1. smarty_main - main log¶
Types of events:
URLS_INITIALIZED¶
Smarty configuration initialized. Occurs during the application start, additional context:
available_apps
- available modules
Events that are unprocessed other loggers¶
Occurs during the error, you need to contact the developer to solve.
Additional context: local variables of the function in which the error occurred.
4.1.2. smarty_accounts - log subscribers¶
Types of events:
LOGIN_SUCCESS¶
A successful authorization, the context:
login_type
- type login (multilogin, basic device, additional equipment)login_method
- the method login (and password pass only pass only the UID of the device)params
- the query parameters
LOGIN_ERROR¶
Authorization error, context:
reason
- the cause of the error:- account_does_not_exist account there is no subscription or password is invalid or device_uid
- account_is_not_active account is not active
- client_does_not_exist - invalid api_key or client_id
- basic_device_sessions_limit - exceeded session limit on the base unit
- account_deivce_invalid - such a basic device already exists
- external_api_error - request error to the external system (e.g. external billing)
- unknown_error - unknown error (accompanied by stacktrace’ohms)
params
- the query parameters
ACCOUNT_DEVICE_ERROR¶
Error when creating a device account context:
account
- accountdevice
- devicedevice_uid
- the UID of the deviceclient
- operator
ACCOUNT_ACTIVATED¶
Account has been activated, the context:
activation_result
- the answer returned by the external systemparams
- the query parameters
ACCOUNT_TARIFFS_ASSIGNED¶
Adding tariffs account context:
account_id
- the account IDtariffs_ids
- the list of IDs of the connected tariffs
ACCOUNT_TARIFFS_REMOVED¶
The removal of tariffs to the account context:
account_id
- the account IDtariffs_ids
- the list of IDs of deleted rates
CUSTOMER_TARIFFS_ASSIGNED¶
Adding tariffs to the subscriber, the context:
customer_id
caller IDtariffs_ids
- the list of IDs of the connected tariffs
CUSTOMER_TARIFFS_REMOVED¶
The removal of tariffs subscriber context:
customer_id
caller IDtariffs_ids
- the list of IDs of deleted rates
ACCOUNT_DEVICE_REMOVED¶
Delete the device account context:
account_id
- the account IDdevice_uid
- the device ID
4.1.3. smarty_billing_out requests to external systems¶
INIT_ERROR¶
Error initializing API handler, context:
kwargs
- the arguments passed in the handler classapi_client_class
- the class name of the handler API- stacktrace
CUSTOMER_BALANCE_REQUEST_ERROR¶
Error balance inquiry, context:
api_client_class
- the class name of the handler APIparams
- the query parameters- stacktrace
CUSTOMER_BALANCE_REQUEST_SUCCESS¶
A successful balance inquiry, context:
api_client_class
- the class name of the handler APIparams
- the query parametersresult
- the result of the query
CUSTOMER_PAYMENT_LIST_REQUEST_ERROR¶
Error when requesting list of transactions that context:
api_client_class
- the class name of the handler APIparams
- the query parameters- stacktrace
CUSTOMER_PAYMENT_LIST_REQUEST_SUCCESS¶
A successful list request transaction context:
api_client_class
- the class name of the handler APIparams
- the query parameters- result - the query result
VIDEO_ACTIONS_LIST_REQUEST_ERROR¶
Error query options with the video context:
api_client_class
- the class name of the handler APIparams
- the query parameters- stacktrace
VIDEO_ACTIONS_LIST_REQUEST_SUCCESS¶
A successful query options with the video context:
api_client_class
- the class name of the handler APIparams
- the query parameters- result - the query result
VIDEO_ACTION_REQUEST_ERROR¶
Error when trying to perform an action with the video context:
api_client_class
- the class name of the handler APIparams
- the query parameters- stacktrace
VIDEO_ACTION_REQUEST_SUCCESS¶
Successful action with the video context:
api_client_class
- the class name of the handler APIparams
- the query parameters- result - the query result
4.1.4. smarty_billing_in incoming requests to the Billing API¶
BILLING_REQUEST_ERROR¶
Error when querying the Billing API context:
url
- URL method, which made the requestthe ip
- the IP address from which the request proizvoditeargs
- arguments of the requesterror_message
- error message- ``”error” `` - error code
BILLING_REQUEST_SUCCESS¶
A successful request to the billing system, the context:
url
- URL method, which made the requestthe ip
- the IP address from which the request proizvoditeargs
- arguments of the request
4.1.5. smarty_cache events related to caching¶
OBJECT_CACHED¶
Cached object, context:
object
- cached objecttimeout
- the time after which the object will be removed from the cachekey
key object in the cachedeps
- objects, changing of which the cached object should be invalizilor
OBJECT_INVALIDATED¶
Invalizilor object, context:
object
- the object that was removed from the cachedeps_key
- the key of the object, where the keys of related objects, which must also be Invalidovna
4.1.6. smarty_messaging - log sent messages for accounts¶
MESSAGE_CREATED¶
Created message context:
account
- the account to which the message was sentsubject
- the subject of the messagetext
- the message text
MESSAGE_SEND¶
The message was sent, the context:
account
- the account to which the message was sentsubject
- the subject of the messagetext
- the message textuuid
- the message ID
MESSAGE_DELETED¶
Message deleted, additional context:
account
- the account to which the message was sentsubject
- the subject of the messagetext
- the message textuuid
- the message ID
4.1.7. smarty_management - log periodic commands¶
MANAGEMENT_COMMAND_SUCCESS¶
Successful execution of the command, additional context:
command
- the team nameexecution_time
- run time
MANAGEMENT_COMMAND_ERROR¶
Error executing the command for more context:
command
- the team name- stacktrace
4.1.8. smarty_epg - log import EPG¶
EPG_CHANNEL_IMPORTED¶
Programs for channel imported successfully, more context:
epg_channel
- channelsource
- the EPG sourceprograms_imported
- the number of imported programmes
EPG_CHANNEL_IMPORT_ERROR¶
Error when importing programs, additional context:
epg_channel
- channelsource
- the EPG source- stacktrace
EPG_IMPORT_FINISHED¶
Import programs are completed, additional context:
channels_processed
- the number of processed channelsprogramms_imported
- the number of imported programmes
EPG_REMOVED¶
In the course of parsing have been removed the old entry for more context:
epg_channel
- channelsource
- the epg sourceremoved_objects
- deleted objects
EPG_TIME_OVERLAP¶
The end time of the previous program start time of the current, more context:
epg_channel
- channelsource
- the epg sourceprogram_name
- the name of the programprevious_program_name
- the name of the previous programprogram_time_begin
- the start time of the current programprevious_time_end
- the end time of the previous program
EPG_TIME_HOLE¶
The end time of the previous program start time less the current, more context:
epg_channel
- channelsource
- the epg sourceprogram_name
- the name of the programprevious_program_name
- the name of the previous programprogram_time_begin
- the start time of the current programprevious_time_end
- the end time of the previous program
EPG_NAME_DOUBLE¶
The name of the current program coincides with the previous one, the additional context:
epg_channel
- channelsource
- the epg sourceprogram_name
- the name of the program
4.1.9. smarty_content_requests - requests for links to/addresses of the stream using TVMW API¶
CONTENT_REQUEST_FAIL¶
Has encountered an unhandled error in the request process, you must contact the developer.
Additional context:
url
- URL method, which made the requestparams
- the query parameters- stacktrace
CONTENT_REQUEST_ERROR¶
Processed error in the request process, additional context:
url
- URL method, which made the requestparams
- the query parameters
Possible causes:
- invalid request parameters
- legacy authorization key
- request to ustravel data (for example, trying to play too old transfer from archive)
CONTENT_REQUEST_SUCCESS¶
A successful query, link the received additional context:
url
- URL method, which made the requestparams
- the query parameters- additional information, including the address of the thread (depending on method)
CLIENT_CHANNELS_NOT_FOUND¶
Not found in the cache channels for a given Client ID may have been reset cache or an error occurred executing the command cache_channel_list
, additional context:
client
- Client ID
4.1.10. smarty_portal - log events portal¶
PORTAL_EVENT¶
The event in the portal additional context:
event_description
- the event descriptionthe ip
- the IP address of the device of the subscriberdevice_uid
- the device IDscreen_name
- title screenuser_agent
- User-Agent device
4.1.11. smarty_stream_services - log-streaming-services¶
STREAM_SERVICE_CHECKING_ERROR¶
Error checking of availability of the streaming service, for more context:
stream_service
- streaming servicewas_available_before
- indicates whether a streaming service available earliercheck_ping_success
- was a successful test of ping (optional)check_tcp_success
- whether successful verification attempt to open socket (optional)check_http_success
- whether successful verification attempt to access the URL (optional)check_is_alive_success
- whether successful test is_alive (optional)- stacktrace
STREAM_SERVICE_CHECKING_SUCCESS¶
Successful checking of availability of the streaming service, for more context:
stream_service
- streaming servicewas_available_before
- indicates whether a streaming service available earliercheck_ping_success
- the ping test was successful (optional)check_tcp_success
- check the attempt to open the socket was successful (optional)check_http_success
- check by trying to open a URL was successful (optional)check_is_alive_success
- check is_alive was successful (optional)
4.1.12. smarty_admin - log admin panel Smarty¶
ADMIN_REQUEST¶
Query the administration interface, additional context:
user
- the user who typed the querythe ip
- the IP of the consumerspath
- the request pathuser_agent
- User-Agent browser
4.1.13. smarty_videoservices - log of requests to video¶
VIDEOSERVICES_REQUEST¶
The user’s query in Smarty to run the command:
the ip
- the IP of the consumersuser_agent
- User-Agent browseruser
- the user who typed the querypath
- the request path
VIDEOSERVICES_API_REQUEST¶
The Smarty request to the video service:
the host
- the type and address of video serviceargs
- arguments of the requestcommand
- the called methodmessage
- the server’s response (only if error)
4.1.14. smarty_payment - лог оплаты¶
NOTIFY_ERROR¶
Ошибка обработки сообщения нотификации, дополнительный контекст:
client
- ID клиента в платёжном шлюзе.transaction
- ID транзакции.payment_source
- название платёжного шлюза.params
- параметры запроса.error
- описание ошибки.
Возможные причины ошибки:
- Неверная настройка платёжного шлюза.
- Передача неверных параметров платёжному шлюзу.
- Платёж не прошёл.
NOTIFY_SUCCESS¶
Успешная нотификация, дополнительный контекст:
client
- ID клиента в платёжном шлюзе.transaction
- ID транзакции.payment_source
- название платёжного шлюза.params
- параметры запроса.
PAYTURE_REQUEST¶
Запрос к платёжному шлюзу Payture:
url
- URL API Payture, на который выполняется запрос.args
- аргументы запроса.response
- ответ от API в виде XML.